diff options
author | Eric Andersen <andersen@codepoet.org> | 2002-09-30 20:39:56 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2002-09-30 20:39:56 +0000 |
commit | 02e6ba91e887bd11146a57185b223582f56f3f09 (patch) | |
tree | cc1954165fe7e6efed1ba0dfa7d5c3aea97fffa5 /libbb/my_getpwuid.c | |
parent | a6f6e06107e69b79858acaa511c452a0a73cf207 (diff) | |
download | busybox-w32-02e6ba91e887bd11146a57185b223582f56f3f09.tar.gz busybox-w32-02e6ba91e887bd11146a57185b223582f56f3f09.tar.bz2 busybox-w32-02e6ba91e887bd11146a57185b223582f56f3f09.zip |
Vodz' last_patch57:
Hi, Erik.
my_getpw(uid/gid) and applets used it have problem:
if username for uid not found, applets can`t detect it
(but code pessent). Also "%8ld " format is bad:
spaces not required (applets have self format
or spec format (tar applet) and overflow for "id" applet...)
This problem also pressent in stable version.
Patch for unstable in attach.
--w
vodz
Diffstat (limited to 'libbb/my_getpwuid.c')
-rw-r--r-- | libbb/my_getpwuid.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/libbb/my_getpwuid.c b/libbb/my_getpwuid.c index 2abe7a7f3..dfe9b4948 100644 --- a/libbb/my_getpwuid.c +++ b/libbb/my_getpwuid.c | |||
@@ -28,15 +28,17 @@ | |||
28 | 28 | ||
29 | 29 | ||
30 | /* gets a username given a uid */ | 30 | /* gets a username given a uid */ |
31 | void my_getpwuid(char *name, long uid) | 31 | char * my_getpwuid(char *name, long uid) |
32 | { | 32 | { |
33 | struct passwd *myuser; | 33 | struct passwd *myuser; |
34 | 34 | ||
35 | myuser = getpwuid(uid); | 35 | myuser = getpwuid(uid); |
36 | if (myuser==NULL) | 36 | if (myuser==NULL) { |
37 | sprintf(name, "%-8ld ", (long)uid); | 37 | sprintf(name, "%ld", (long)uid); |
38 | else | 38 | return NULL; |
39 | strcpy(name, myuser->pw_name); | 39 | } else { |
40 | return strcpy(name, myuser->pw_name); | ||
41 | } | ||
40 | } | 42 | } |
41 | 43 | ||
42 | /* END CODE */ | 44 | /* END CODE */ |