aboutsummaryrefslogtreecommitdiff
path: root/libbb/procps.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-06-06 07:40:16 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-06-06 07:40:16 +0000
commit0696b8aae8c5e84d47893a78d6b7aeb416cba38e (patch)
treefc94b703c836f020e3b0bab10373057e75e6822f /libbb/procps.c
parentcd0df46d8cb937ef277659ea339a77925c443d3d (diff)
downloadbusybox-0696b8aae8c5e84d47893a78d6b7aeb416cba38e.tar.gz
ps: fix -Z (by Yuichi Nakamura <ynakam@hitachisoft.jp>)
Diffstat (limited to 'libbb/procps.c')
-rw-r--r--libbb/procps.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libbb/procps.c b/libbb/procps.c
index 946f569f5..be0d61bd3 100644
--- a/libbb/procps.c
+++ b/libbb/procps.c
@@ -4,7 +4,8 @@
*
* Copyright 1998 by Albert Cahalan; all rights reserved.
* Copyright (C) 2002 by Vladimir Oleynik <dzo@simtreas.ru>
- *
+ * SELinux support: (c) 2007 by Yuichi Nakamura <ynakam@hitachisoft.jp>
+ *
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
@@ -95,6 +96,7 @@ void free_procps_scan(procps_status_t* sp)
{
closedir(sp->dir);
free(sp->cmd);
+ USE_SELINUX(free(sp->context);)
free(sp);
}
@@ -132,6 +134,13 @@ procps_status_t* procps_scan(procps_status_t* sp, int flags)
sp->pid = pid;
if (!(flags & ~PSSCAN_PID)) break;
+#if ENABLE_SELINUX
+ if (flags & PSSCAN_CONTEXT) {
+ if (getpidcon(sp->pid, &sp->context) < 0)
+ sp->context = NULL;
+ }
+#endif
+
filename_tail = filename + sprintf(filename, "/proc/%d", pid);
if (flags & PSSCAN_UIDGID) {