diff options
author | Erik Andersen | 2000-05-01 19:49:20 +0000 |
---|---|---|
committer | Erik Andersen | 2000-05-01 19:49:20 +0000 |
commit | 9b7d96458175a852f71700922ca2950577b95f27 (patch) | |
tree | 623a992e90290849c3a260e2a18983504f6ed47e /logname.c | |
parent | f378fced43edd9c4ae4a31117b74f467dcd75f01 (diff) | |
download | busybox-9b7d96458175a852f71700922ca2950577b95f27.zip busybox-9b7d96458175a852f71700922ca2950577b95f27.tar.gz |
My little adventure of analyzing lib usage has already rooted out
a big "P" Policy violator -- logname was using getlogin(3), which uses
utmp under the hood. We don't need no stinkin' utmp (and if we
are using tinylogin, it is unlikely to be useful trying).
-Erik
Diffstat (limited to 'logname.c')
-rw-r--r-- | logname.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -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); } |