diff options
Diffstat (limited to 'libbb/my_getgrgid.c')
-rw-r--r-- | libbb/my_getgrgid.c | 12 |
1 files changed, 7 insertions, 5 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); + } } |