diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-06-06 07:40:16 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-06-06 07:40:16 +0000 |
commit | 0696b8aae8c5e84d47893a78d6b7aeb416cba38e (patch) | |
tree | fc94b703c836f020e3b0bab10373057e75e6822f /libbb | |
parent | cd0df46d8cb937ef277659ea339a77925c443d3d (diff) | |
download | busybox-w32-0696b8aae8c5e84d47893a78d6b7aeb416cba38e.tar.gz busybox-w32-0696b8aae8c5e84d47893a78d6b7aeb416cba38e.tar.bz2 busybox-w32-0696b8aae8c5e84d47893a78d6b7aeb416cba38e.zip |
ps: fix -Z (by Yuichi Nakamura <ynakam@hitachisoft.jp>)
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/procps.c | 11 |
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 @@ | |||
4 | * | 4 | * |
5 | * Copyright 1998 by Albert Cahalan; all rights reserved. | 5 | * Copyright 1998 by Albert Cahalan; all rights reserved. |
6 | * Copyright (C) 2002 by Vladimir Oleynik <dzo@simtreas.ru> | 6 | * Copyright (C) 2002 by Vladimir Oleynik <dzo@simtreas.ru> |
7 | * | 7 | * SELinux support: (c) 2007 by Yuichi Nakamura <ynakam@hitachisoft.jp> |
8 | * | ||
8 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. | 9 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
9 | */ | 10 | */ |
10 | 11 | ||
@@ -95,6 +96,7 @@ void free_procps_scan(procps_status_t* sp) | |||
95 | { | 96 | { |
96 | closedir(sp->dir); | 97 | closedir(sp->dir); |
97 | free(sp->cmd); | 98 | free(sp->cmd); |
99 | USE_SELINUX(free(sp->context);) | ||
98 | free(sp); | 100 | free(sp); |
99 | } | 101 | } |
100 | 102 | ||
@@ -132,6 +134,13 @@ procps_status_t* procps_scan(procps_status_t* sp, int flags) | |||
132 | sp->pid = pid; | 134 | sp->pid = pid; |
133 | if (!(flags & ~PSSCAN_PID)) break; | 135 | if (!(flags & ~PSSCAN_PID)) break; |
134 | 136 | ||
137 | #if ENABLE_SELINUX | ||
138 | if (flags & PSSCAN_CONTEXT) { | ||
139 | if (getpidcon(sp->pid, &sp->context) < 0) | ||
140 | sp->context = NULL; | ||
141 | } | ||
142 | #endif | ||
143 | |||
135 | filename_tail = filename + sprintf(filename, "/proc/%d", pid); | 144 | filename_tail = filename + sprintf(filename, "/proc/%d", pid); |
136 | 145 | ||
137 | if (flags & PSSCAN_UIDGID) { | 146 | if (flags & PSSCAN_UIDGID) { |