summaryrefslogtreecommitdiffhomepage
path: root/libbb/my_getpwuid.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/my_getpwuid.c')
-rw-r--r--libbb/my_getpwuid.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/libbb/my_getpwuid.c b/libbb/my_getpwuid.c
index 2abe7a7f3..dfe9b4948 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 */