[BusyBox-cvs] busybox/libbb procps.c,1.12,1.13

Erik Andersen andersen at busybox.net
Tue Jan 27 20:17:42 UTC 2004


Update of /var/cvs/busybox/libbb
In directory nail:/tmp/cvs-serv16238/libbb

Modified Files:
	procps.c 
Log Message:
Teach busybox ps to get the correct uid when displaying stuff


Index: procps.c
===================================================================
RCS file: /var/cvs/busybox/libbb/procps.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- procps.c	21 Jan 2004 11:36:44 -0000	1.12
+++ procps.c	27 Jan 2004 20:17:39 -0000	1.13
@@ -54,6 +54,11 @@
 		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 @@
 		}
 		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)




More information about the busybox-cvs mailing list