summaryrefslogtreecommitdiff
path: root/coreutils/whoami.c
diff options
context:
space:
mode:
authorEric Andersen2000-12-13 01:52:39 +0000
committerEric Andersen2000-12-13 01:52:39 +0000
commitbd193a42a5624f0a72b5f99d554e9a8d2afc64cc (patch)
tree7aacebe98730fbfee623943425a100fd158ba48a /coreutils/whoami.c
parent77508b29fa63d99136fc09f00c5a2addd6331b4c (diff)
downloadbusybox-bd193a42a5624f0a72b5f99d554e9a8d2afc64cc.zip
busybox-bd193a42a5624f0a72b5f99d554e9a8d2afc64cc.tar.gz
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 'coreutils/whoami.c')
-rw-r--r--coreutils/whoami.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/coreutils/whoami.c b/coreutils/whoami.c
index 6a5dd2c..38a2b30 100644
--- a/coreutils/whoami.c
+++ b/coreutils/whoami.c
@@ -26,14 +26,14 @@
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);
my_getpwuid(user, uid);
- if (user) {
+ if (*user) {
puts(user);
return EXIT_SUCCESS;
}