diff options
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/my_getgrgid.c | 12 | ||||
-rw-r--r-- | libbb/my_getpwuid.c | 12 |
2 files changed, 14 insertions, 10 deletions
diff --git a/libbb/my_getgrgid.c b/libbb/my_getgrgid.c index 88bafc9..5bf9051 100644 --- a/libbb/my_getgrgid.c +++ b/libbb/my_getgrgid.c @@ -27,15 +27,17 @@ /* gets a groupname given a gid */ -void my_getgrgid(char *group, long gid) +char * my_getgrgid(char *group, long gid) { struct group *mygroup; mygroup = getgrgid(gid); - if (mygroup==NULL) - sprintf(group, "%-8ld ", (long)gid); - else - strcpy(group, mygroup->gr_name); + if (mygroup==NULL) { + sprintf(group, "%ld", gid); + return NULL; + } else { + return strcpy(group, mygroup->gr_name); + } } diff --git a/libbb/my_getpwuid.c b/libbb/my_getpwuid.c index 2abe7a7..dfe9b49 100644 --- a/libbb/my_getpwuid.c +++ b/libbb/my_getpwuid.c @@ -28,15 +28,17 @@ /* gets a username given a uid */ -void my_getpwuid(char *name, long uid) +char * my_getpwuid(char *name, long uid) { struct passwd *myuser; myuser = getpwuid(uid); - if (myuser==NULL) - sprintf(name, "%-8ld ", (long)uid); - else - strcpy(name, myuser->pw_name); + if (myuser==NULL) { + sprintf(name, "%ld", (long)uid); + return NULL; + } else { + return strcpy(name, myuser->pw_name); + } } /* END CODE */ |