some coverity fixes.
[minix.git] / lib / libc / sys-minix / __getlogin.c
blob4194db6246c0b798794e307cca1833dc7237260f
1 /* getlogin(3)
3 * Author: Terrence W. Holm Aug. 1988
4 */
6 #include <sys/cdefs.h>
7 #include "namespace.h"
8 #include <lib.h>
10 #include <pwd.h>
11 #include <unistd.h>
12 #include <string.h>
13 #include <stdio.h>
14 #include "extern.h"
18 int __getlogin(char *logname, size_t sz)
20 struct passwd *pw_entry;
22 pw_entry = getpwuid(getuid());
24 if (pw_entry == (struct passwd *)NULL)
25 return 0;
27 strncpy(logname, pw_entry->pw_name, sz);
28 return sz;