diff options
author | Eric Andersen <andersen@codepoet.org> | 2000-12-13 01:52:39 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2000-12-13 01:52:39 +0000 |
commit | bd193a42a5624f0a72b5f99d554e9a8d2afc64cc (patch) | |
tree | 7aacebe98730fbfee623943425a100fd158ba48a /whoami.c | |
parent | 77508b29fa63d99136fc09f00c5a2addd6331b4c (diff) | |
download | busybox-w32-bd193a42a5624f0a72b5f99d554e9a8d2afc64cc.tar.gz busybox-w32-bd193a42a5624f0a72b5f99d554e9a8d2afc64cc.tar.bz2 busybox-w32-bd193a42a5624f0a72b5f99d554e9a8d2afc64cc.zip |
Fix from Matt Kraai -- a better way to NULL terminate strings for the
my_* passwd and group routines. I should have thought of doing it
this way...
Diffstat (limited to 'whoami.c')
-rw-r--r-- | whoami.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -26,14 +26,14 @@ | |||
26 | 26 | ||
27 | extern int whoami_main(int argc, char **argv) | 27 | extern int whoami_main(int argc, char **argv) |
28 | { | 28 | { |
29 | char *user = xmalloc(9); | 29 | char user[9]; |
30 | uid_t uid = geteuid(); | 30 | uid_t uid = geteuid(); |
31 | 31 | ||
32 | if (argc > 1) | 32 | if (argc > 1) |
33 | usage(whoami_usage); | 33 | usage(whoami_usage); |
34 | 34 | ||
35 | my_getpwuid(user, uid); | 35 | my_getpwuid(user, uid); |
36 | if (user) { | 36 | if (*user) { |
37 | puts(user); | 37 | puts(user); |
38 | return EXIT_SUCCESS; | 38 | return EXIT_SUCCESS; |
39 | } | 39 | } |