diff options
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/id.c | 10 | ||||
-rw-r--r-- | coreutils/whoami.c | 2 |
2 files changed, 4 insertions, 8 deletions
diff --git a/coreutils/id.c b/coreutils/id.c index 6ddb23666..33e06f427 100644 --- a/coreutils/id.c +++ b/coreutils/id.c | |||
@@ -36,12 +36,8 @@ enum { | |||
36 | #endif | 36 | #endif |
37 | }; | 37 | }; |
38 | 38 | ||
39 | static int print_common(unsigned id, | 39 | static int print_common(unsigned id, const char *name, const char *prefix) |
40 | char* FAST_FUNC bb_getXXXid(char *name, int bufsize, long uid), | ||
41 | const char *prefix) | ||
42 | { | 40 | { |
43 | const char *name = bb_getXXXid(NULL, 0, id); | ||
44 | |||
45 | if (prefix) { | 41 | if (prefix) { |
46 | printf("%s", prefix); | 42 | printf("%s", prefix); |
47 | } | 43 | } |
@@ -65,12 +61,12 @@ static int print_common(unsigned id, | |||
65 | 61 | ||
66 | static int print_group(gid_t id, const char *prefix) | 62 | static int print_group(gid_t id, const char *prefix) |
67 | { | 63 | { |
68 | return print_common(id, bb_getgrgid, prefix); | 64 | return print_common(id, gid2group(id), prefix); |
69 | } | 65 | } |
70 | 66 | ||
71 | static int print_user(uid_t id, const char *prefix) | 67 | static int print_user(uid_t id, const char *prefix) |
72 | { | 68 | { |
73 | return print_common(id, bb_getpwuid, prefix); | 69 | return print_common(id, uid2uname(id), prefix); |
74 | } | 70 | } |
75 | 71 | ||
76 | /* On error set *n < 0 and return >= 0 | 72 | /* On error set *n < 0 and return >= 0 |
diff --git a/coreutils/whoami.c b/coreutils/whoami.c index 6756d4ba9..0dbcba955 100644 --- a/coreutils/whoami.c +++ b/coreutils/whoami.c | |||
@@ -20,7 +20,7 @@ int whoami_main(int argc, char **argv UNUSED_PARAM) | |||
20 | bb_show_usage(); | 20 | bb_show_usage(); |
21 | 21 | ||
22 | /* Will complain and die if username not found */ | 22 | /* Will complain and die if username not found */ |
23 | puts(bb_getpwuid(NULL, -1, geteuid())); | 23 | puts(xuid2uname(geteuid())); |
24 | 24 | ||
25 | return fflush(stdout); | 25 | return fflush(stdout); |
26 | } | 26 | } |