summaryrefslogtreecommitdiff
path: root/coreutils/whoami.c
diff options
context:
space:
mode:
authorErik Andersen2000-05-02 00:07:56 +0000
committerErik Andersen2000-05-02 00:07:56 +0000
commit5afc864422e8c572a13b3e48df47fd0e56cfbb74 (patch)
tree5a6ec9054284616133cdea4b62efdcbaddd061f9 /coreutils/whoami.c
parent3c1217cfad0fb72f458223ae73e1ce612f5e9efd (diff)
downloadbusybox-5afc864422e8c572a13b3e48df47fd0e56cfbb74.zip
busybox-5afc864422e8c572a13b3e48df47fd0e56cfbb74.tar.gz
More stuff
-Erik
Diffstat (limited to 'coreutils/whoami.c')
-rw-r--r--coreutils/whoami.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/coreutils/whoami.c b/coreutils/whoami.c
index 5c3fea1..f9d3f28 100644
--- a/coreutils/whoami.c
+++ b/coreutils/whoami.c
@@ -29,16 +29,15 @@ static const char whoami_usage[] = "whoami\n\n"
extern int whoami_main(int argc, char **argv)
{
- struct passwd *pw;
- uid_t uid;
+ char *user = xmalloc(9);
+ uid_t uid = geteuid();
if (argc > 1)
usage(whoami_usage);
- uid = geteuid();
- pw = getpwuid(uid);
- if (pw) {
- puts(pw->pw_name);
+ my_getpwuid(user, uid);
+ if (user) {
+ puts(user);
exit(TRUE);
}
fprintf(stderr, "%s: cannot find username for UID %u\n", argv[0],