aboutsummaryrefslogtreecommitdiff
path: root/logname.c
diff options
context:
space:
mode:
Diffstat (limited to 'logname.c')
-rw-r--r--logname.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/logname.c b/logname.c
index 182f40ed2..bde1752ba 100644
--- a/logname.c
+++ b/logname.c
@@ -29,16 +29,16 @@ static const char logname_usage[] = "logname\n\n"
extern int logname_main(int argc, char **argv)
{
- char *cp;
+ char *user = xmalloc(9);
if (argc > 1)
usage(logname_usage);
- cp = getlogin();
- if (cp) {
- puts(cp);
+ my_getpwuid(user, geteuid());
+ if (user) {
+ puts(user);
exit(TRUE);
}
- fprintf(stderr, "%s: no login name\n", argv[0]);
+ fprintf(stderr, "no login name\n");
exit(FALSE);
}