X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=coreutils%2Fwhoami.c;h=0bbb54b7b2abaf594d844e0ac7ff3043cf4fa339;hb=eba8ed71f08f334bc94ac8eeedcd998fcdd05897;hp=6a5dd2c04ef9b5bfe37ce5bd252b41ee80ef1cec;hpb=f57c944e09417edcbcd69f2b01b937cadef39db2;p=oweals%2Fbusybox.git diff --git a/coreutils/whoami.c b/coreutils/whoami.c index 6a5dd2c04..0bbb54b7b 100644 --- a/coreutils/whoami.c +++ b/coreutils/whoami.c @@ -20,22 +20,23 @@ * */ -#include "busybox.h" #include -#include +#include +#include +#include "busybox.h" extern int whoami_main(int argc, char **argv) { - char *user = xmalloc(9); + char user[9]; uid_t uid = geteuid(); if (argc > 1) - usage(whoami_usage); + show_usage(); my_getpwuid(user, uid); - if (user) { + if (*user) { puts(user); return EXIT_SUCCESS; } - error_msg_and_die("cannot find username for UID %u\n", (unsigned) uid); + error_msg_and_die("cannot find username for UID %u", (unsigned) uid); }