blob: f04f71e54eeea71f7e68d39e8612b8f1fc5c2696 (
plain) (
tree)
|
|
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
int getlogin_r(char *name, size_t size)
{
char *logname = getlogin();
if (!logname) return ENXIO; /* or...? */
if (strlen(name) >= size) return ERANGE;
strcpy(name, logname);
return 0;
}
|