aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/logname.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/coreutils/logname.c b/coreutils/logname.c
index 182f40ed2..bde1752ba 100644
--- a/coreutils/logname.c
+++ b/coreutils/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);
}