diff options
Diffstat (limited to 'libc-top-half/musl/src/unistd/getlogin_r.c')
-rw-r--r-- | libc-top-half/musl/src/unistd/getlogin_r.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libc-top-half/musl/src/unistd/getlogin_r.c b/libc-top-half/musl/src/unistd/getlogin_r.c new file mode 100644 index 0000000..53866c6 --- /dev/null +++ b/libc-top-half/musl/src/unistd/getlogin_r.c @@ -0,0 +1,12 @@ +#include <unistd.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; +} |