[patch] ps -Z can not be used when ENABLE_DESKTOP is enabled

Denis Vlasenko vda.linux at googlemail.com
Sat May 12 03:17:10 PDT 2007


On Friday 11 May 2007 07:06, Yuichi Nakamura wrote:
> 
> There was a bug in previous patch.
> I have received ver 2 from Shinji.
> Please review this one.

#if ENABLE_SELINUX are missing.

+static void func_label(char *buf, int size, const procps_status_t *ps)
+{
+       char procfilename[30];
+       FILE *fp;
+       snprintf(procfilename, 30, "/proc/%d/attr/current", ps->pid);
+       buf[0] = '\0';
+       if ((fp = fopen(procfilename, "r")) != NULL) {
+               fgets(buf, size+1, fp);
+               fclose(fp);
+       }
+}

/proc parsing code should be in libbb, in procps_scan() function,
this allows to share code between ps and top. PSSCAN_LABEL bit should indicate
to procps_scan() that we need label retrieved.

You coded it so that ps reads label by itself, thus in the patch
PSSCAN_LABEL seems to have no purpose.

I added ENABLE_SELINUX checks, and did some other changes,
but did not move /proc/NN/attr/current parsing into procps_scan().
Can you do it?

See attached.
--
vda
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1.patch
Type: text/x-diff
Size: 2527 bytes
Desc: not available
Url : http://busybox.net/lists/busybox/attachments/20070512/714edbb5/attachment.bin 


More information about the busybox mailing list