aboutsummaryrefslogtreecommitdiff
path: root/coreutils/whoami.c
diff options
context:
space:
mode:
authormjn3 <mjn3@69ca8d6d-28ef-0310-b511-8ec308f3f277>2003-03-19 09:13:01 +0000
committermjn3 <mjn3@69ca8d6d-28ef-0310-b511-8ec308f3f277>2003-03-19 09:13:01 +0000
commite901c15d890dbbdce4c086963cb1513653fc46b5 (patch)
treea318d0f03aa076c74b576ea45dc543a5669e8e91 /coreutils/whoami.c
parent40758c00616c3b2c85d83eb4afdeb04b1f65c9f1 (diff)
downloadbusybox-w32-e901c15d890dbbdce4c086963cb1513653fc46b5.tar.gz
busybox-w32-e901c15d890dbbdce4c086963cb1513653fc46b5.tar.bz2
busybox-w32-e901c15d890dbbdce4c086963cb1513653fc46b5.zip
Major coreutils update.
git-svn-id: svn://busybox.net/trunk/busybox@6751 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'coreutils/whoami.c')
-rw-r--r--coreutils/whoami.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/coreutils/whoami.c b/coreutils/whoami.c
index a9d6ecf26..f93034d3a 100644
--- a/coreutils/whoami.c
+++ b/coreutils/whoami.c
@@ -20,7 +20,7 @@
20 * 20 *
21 */ 21 */
22 22
23/* getopt not needed */ 23/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
24 24
25#include <stdio.h> 25#include <stdio.h>
26#include <stdlib.h> 26#include <stdlib.h>
@@ -30,14 +30,15 @@
30extern int whoami_main(int argc, char **argv) 30extern int whoami_main(int argc, char **argv)
31{ 31{
32 char user[9]; 32 char user[9];
33 uid_t uid = geteuid(); 33 uid_t uid;
34 34
35 if (argc > 1) 35 if (argc > 1)
36 show_usage(); 36 bb_show_usage();
37 37
38 uid = geteuid();
38 if (my_getpwuid(user, uid)) { 39 if (my_getpwuid(user, uid)) {
39 puts(user); 40 puts(user);
40 return EXIT_SUCCESS; 41 bb_fflush_stdout_and_exit(EXIT_SUCCESS);
41 } 42 }
42 error_msg_and_die("cannot find username for UID %u", (unsigned) uid); 43 bb_error_msg_and_die("cannot find username for UID %u", (unsigned) uid);
43} 44}