diff options
Diffstat (limited to 'src/firemon/interface.c')
-rw-r--r-- | src/firemon/interface.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/firemon/interface.c b/src/firemon/interface.c index 5a89e1491..def9cd5ac 100644 --- a/src/firemon/interface.c +++ b/src/firemon/interface.c | |||
@@ -145,32 +145,31 @@ static void print_sandbox(pid_t pid) { | |||
145 | if (rv) | 145 | if (rv) |
146 | return; | 146 | return; |
147 | net_ifprint(); | 147 | net_ifprint(); |
148 | printf("\n"); | 148 | #ifdef HAVE_GCOV |
149 | exit(0); | 149 | __gcov_flush(); |
150 | #endif | ||
151 | _exit(0); | ||
150 | } | 152 | } |
151 | 153 | ||
152 | // wait for the child to finish | 154 | // wait for the child to finish |
153 | waitpid(child, NULL, 0); | 155 | waitpid(child, NULL, 0); |
154 | } | 156 | } |
155 | 157 | ||
156 | void interface(pid_t pid) { | 158 | void interface(pid_t pid, int print_procs) { |
157 | if (getuid() != 0) { | ||
158 | fprintf(stderr, "Error: you need to be root to run this command\n"); | ||
159 | exit(1); | ||
160 | } | ||
161 | |||
162 | pid_read(pid); // a pid of 0 will include all processes | 159 | pid_read(pid); // a pid of 0 will include all processes |
163 | 160 | ||
164 | // print processes | 161 | // print processes |
165 | int i; | 162 | int i; |
166 | for (i = 0; i < max_pids; i++) { | 163 | for (i = 0; i < max_pids; i++) { |
167 | if (pids[i].level == 1) { | 164 | if (pids[i].level == 1) { |
168 | pid_print_list(i, 0); | 165 | if (print_procs || pid == 0) |
166 | pid_print_list(i, 0); | ||
169 | int child = find_child(i); | 167 | int child = find_child(i); |
170 | if (child != -1) { | 168 | if (child != -1) { |
171 | print_sandbox(child); | 169 | print_sandbox(child); |
172 | } | 170 | } |
173 | } | 171 | } |
174 | } | 172 | } |
173 | printf("\n"); | ||
175 | } | 174 | } |
176 | 175 | ||