summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen2004-01-27 20:17:39 +0000
committerEric Andersen2004-01-27 20:17:39 +0000
commit242ab8349995f97807896835a6c680d57567aa1a (patch)
tree5d70f728c0ead92057792fbed6e3837b8c1104c1
parent82364bb59100c690a5cdee308da990577b91fe5a (diff)
downloadbusybox-242ab8349995f97807896835a6c680d57567aa1a.zip
busybox-242ab8349995f97807896835a6c680d57567aa1a.tar.gz
Teach busybox ps to get the correct uid when displaying stuff
-rw-r--r--libbb/procps.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libbb/procps.c b/libbb/procps.c
index 252e9c7..46e9827 100644
--- a/libbb/procps.c
+++ b/libbb/procps.c
@@ -54,6 +54,11 @@ extern procps_status_t * procps_scan(int save_user_arg0
pid = atoi(name);
curstatus.pid = pid;
+ sprintf(status, "/proc/%d", pid);
+ if(stat(status, &sb))
+ continue;
+ my_getpwuid(curstatus.user, sb.st_uid);
+
sprintf(status, "/proc/%d/stat", pid);
if((fp = fopen(status, "r")) == NULL)
continue;
@@ -65,9 +70,6 @@ extern procps_status_t * procps_scan(int save_user_arg0
}
else
#endif
- if(fstat(fileno(fp), &sb))
- continue;
- my_getpwuid(curstatus.user, sb.st_uid);
name = fgets(buf, sizeof(buf), fp);
fclose(fp);
if(name == NULL)