diff options
Diffstat (limited to 'src/firemon/caps.c')
-rw-r--r-- | src/firemon/caps.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/firemon/caps.c b/src/firemon/caps.c index 5cd9b5d0d..3f8a139ae 100644 --- a/src/firemon/caps.c +++ b/src/firemon/caps.c | |||
@@ -24,7 +24,6 @@ static void print_caps(int pid) { | |||
24 | char *file; | 24 | char *file; |
25 | if (asprintf(&file, "/proc/%d/status", pid) == -1) { | 25 | if (asprintf(&file, "/proc/%d/status", pid) == -1) { |
26 | errExit("asprintf"); | 26 | errExit("asprintf"); |
27 | exit(1); | ||
28 | } | 27 | } |
29 | 28 | ||
30 | FILE *fp = fopen(file, "r"); | 29 | FILE *fp = fopen(file, "r"); |
@@ -48,17 +47,15 @@ static void print_caps(int pid) { | |||
48 | free(file); | 47 | free(file); |
49 | } | 48 | } |
50 | 49 | ||
51 | void caps(pid_t pid) { | 50 | void caps(pid_t pid, int print_procs) { |
52 | if (getuid() == 0) | ||
53 | firemon_drop_privs(); | ||
54 | |||
55 | pid_read(pid); // include all processes | 51 | pid_read(pid); // include all processes |
56 | 52 | ||
57 | // print processes | 53 | // print processes |
58 | int i; | 54 | int i; |
59 | for (i = 0; i < max_pids; i++) { | 55 | for (i = 0; i < max_pids; i++) { |
60 | if (pids[i].level == 1) { | 56 | if (pids[i].level == 1) { |
61 | pid_print_list(i, 0); | 57 | if (print_procs || pid == 0) |
58 | pid_print_list(i, 0); | ||
62 | int child = find_child(i); | 59 | int child = find_child(i); |
63 | if (child != -1) | 60 | if (child != -1) |
64 | print_caps(child); | 61 | print_caps(child); |