blob: 37ce0d43dafb92e5bd6f2cb8ffa60ee3619b43d9 (
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(logname) >= size) return ERANGE;
strcpy(name, logname);
return 0;
}
|