diff options
Diffstat (limited to 'libbb/procps.c')
-rw-r--r-- | libbb/procps.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libbb/procps.c b/libbb/procps.c index 4d9a95b4f..c5e40bf88 100644 --- a/libbb/procps.c +++ b/libbb/procps.c | |||
@@ -13,7 +13,7 @@ | |||
13 | 13 | ||
14 | 14 | ||
15 | typedef struct unsigned_to_name_map_t { | 15 | typedef struct unsigned_to_name_map_t { |
16 | unsigned id; | 16 | long id; |
17 | char name[USERNAME_MAX_SIZE]; | 17 | char name[USERNAME_MAX_SIZE]; |
18 | } unsigned_to_name_map_t; | 18 | } unsigned_to_name_map_t; |
19 | 19 | ||
@@ -52,8 +52,8 @@ static int get_cached(cache_t *cp, unsigned id) | |||
52 | } | 52 | } |
53 | #endif | 53 | #endif |
54 | 54 | ||
55 | typedef char* FAST_FUNC ug_func(char *name, int bufsize, long uid); | 55 | static char* get_cached(cache_t *cp, long id, |
56 | static char* get_cached(cache_t *cp, unsigned id, ug_func* fp) | 56 | char* FAST_FUNC x2x_utoa(long id)) |
57 | { | 57 | { |
58 | int i; | 58 | int i; |
59 | for (i = 0; i < cp->size; i++) | 59 | for (i = 0; i < cp->size; i++) |
@@ -63,16 +63,16 @@ static char* get_cached(cache_t *cp, unsigned id, ug_func* fp) | |||
63 | cp->cache = xrealloc_vector(cp->cache, 2, i); | 63 | cp->cache = xrealloc_vector(cp->cache, 2, i); |
64 | cp->cache[i].id = id; | 64 | cp->cache[i].id = id; |
65 | /* Never fails. Generates numeric string if name isn't found */ | 65 | /* Never fails. Generates numeric string if name isn't found */ |
66 | fp(cp->cache[i].name, sizeof(cp->cache[i].name), id); | 66 | safe_strncpy(cp->cache[i].name, x2x_utoa(id), sizeof(cp->cache[i].name)); |
67 | return cp->cache[i].name; | 67 | return cp->cache[i].name; |
68 | } | 68 | } |
69 | const char* FAST_FUNC get_cached_username(uid_t uid) | 69 | const char* FAST_FUNC get_cached_username(uid_t uid) |
70 | { | 70 | { |
71 | return get_cached(&username, uid, bb_getpwuid); | 71 | return get_cached(&username, uid, uid2uname_utoa); |
72 | } | 72 | } |
73 | const char* FAST_FUNC get_cached_groupname(gid_t gid) | 73 | const char* FAST_FUNC get_cached_groupname(gid_t gid) |
74 | { | 74 | { |
75 | return get_cached(&groupname, gid, bb_getgrgid); | 75 | return get_cached(&groupname, gid, gid2group_utoa); |
76 | } | 76 | } |
77 | 77 | ||
78 | 78 | ||