bb_getpwuid, bb_getgrgid: change order of arguments to more intuitive one;

comment thoroughly when they die and when they dont.
This commit is contained in:
Denis Vlasenko
2007-07-27 11:20:10 +00:00
parent 661f6fad77
commit 3734b946bf
7 changed files with 68 additions and 87 deletions

View File

@@ -52,7 +52,7 @@ static int get_cached(cache_t *cp, unsigned id)
}
#endif
typedef char* ug_func(char *name, long uid, int bufsize);
typedef char* ug_func(char *name, int bufsize, long uid);
static char* get_cached(cache_t *cp, unsigned id, ug_func* fp)
{
int i;
@@ -62,7 +62,8 @@ static char* get_cached(cache_t *cp, unsigned id, ug_func* fp)
i = cp->size++;
cp->cache = xrealloc(cp->cache, cp->size * sizeof(*cp->cache));
cp->cache[i].id = id;
fp(cp->cache[i].name, id, sizeof(cp->cache[i].name));
/* Never fails. Generates numeric string if name isn't found */
fp(cp->cache[i].name, sizeof(cp->cache[i].name), id);
return cp->cache[i].name;
}
const char* get_cached_username(uid_t uid)