aboutsummaryrefslogtreecommitdiffstats
path: root/src/firemon/interface.c
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2016-11-12 07:36:41 -0500
committerLibravatar netblue30 <netblue30@yahoo.com>2016-11-12 07:36:41 -0500
commitca79ff961cc303670f1ccb8841495ddd7f17a76b (patch)
tree51de876c47e405afec28eed5562337782265eebe /src/firemon/interface.c
parenttesting (diff)
downloadfirejail-ca79ff961cc303670f1ccb8841495ddd7f17a76b.tar.gz
firejail-ca79ff961cc303670f1ccb8841495ddd7f17a76b.tar.zst
firejail-ca79ff961cc303670f1ccb8841495ddd7f17a76b.zip
testing
Diffstat (limited to 'src/firemon/interface.c')
-rw-r--r--src/firemon/interface.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/firemon/interface.c b/src/firemon/interface.c
index 58990e6e5..def9cd5ac 100644
--- a/src/firemon/interface.c
+++ b/src/firemon/interface.c
@@ -145,7 +145,6 @@ 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");
149#ifdef HAVE_GCOV 148#ifdef HAVE_GCOV
150 __gcov_flush(); 149 __gcov_flush();
151#endif 150#endif
@@ -156,24 +155,21 @@ static void print_sandbox(pid_t pid) {
156 waitpid(child, NULL, 0); 155 waitpid(child, NULL, 0);
157} 156}
158 157
159void interface(pid_t pid) { 158void interface(pid_t pid, int print_procs) {
160 if (getuid() != 0) {
161 fprintf(stderr, "Error: you need to be root to run this command\n");
162 exit(1);
163 }
164
165 pid_read(pid); // a pid of 0 will include all processes 159 pid_read(pid); // a pid of 0 will include all processes
166 160
167 // print processes 161 // print processes
168 int i; 162 int i;
169 for (i = 0; i < max_pids; i++) { 163 for (i = 0; i < max_pids; i++) {
170 if (pids[i].level == 1) { 164 if (pids[i].level == 1) {
171 pid_print_list(i, 0); 165 if (print_procs || pid == 0)
166 pid_print_list(i, 0);
172 int child = find_child(i); 167 int child = find_child(i);
173 if (child != -1) { 168 if (child != -1) {
174 print_sandbox(child); 169 print_sandbox(child);
175 } 170 }
176 } 171 }
177 } 172 }
173 printf("\n");
178} 174}
179 175