aboutsummaryrefslogtreecommitdiffstats
path: root/src/firemon/firemon.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/firemon/firemon.c')
-rw-r--r--src/firemon/firemon.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/firemon/firemon.c b/src/firemon/firemon.c
index da5cc2d97..aaeffdbd2 100644
--- a/src/firemon/firemon.c
+++ b/src/firemon/firemon.c
@@ -24,7 +24,7 @@
24#include <sys/prctl.h> 24#include <sys/prctl.h>
25#include <grp.h> 25#include <grp.h>
26#include <sys/stat.h> 26#include <sys/stat.h>
27 27
28static int arg_route = 0; 28static int arg_route = 0;
29static int arg_arp = 0; 29static int arg_arp = 0;
30static int arg_tree = 0; 30static int arg_tree = 0;
@@ -49,7 +49,7 @@ static void my_handler(int s){
49 49
50 if (terminal_set) 50 if (terminal_set)
51 tcsetattr(0, TCSANOW, &tlocal); 51 tcsetattr(0, TCSANOW, &tlocal);
52 exit(0); 52 exit(0);
53} 53}
54 54
55// find the first child process for the specified pid 55// find the first child process for the specified pid
@@ -60,7 +60,7 @@ int find_child(int id) {
60 if (pids[i].level == 2 && pids[i].parent == id) 60 if (pids[i].level == 2 && pids[i].parent == id)
61 return i; 61 return i;
62 } 62 }
63 63
64 return -1; 64 return -1;
65} 65}
66 66
@@ -118,7 +118,7 @@ int main(int argc, char **argv) {
118 printf("firemon version %s\n\n", VERSION); 118 printf("firemon version %s\n\n", VERSION);
119 return 0; 119 return 0;
120 } 120 }
121 121
122 // options without a pid argument 122 // options without a pid argument
123 else if (strcmp(argv[i], "--top") == 0) 123 else if (strcmp(argv[i], "--top") == 0)
124 arg_top = 1; 124 arg_top = 1;
@@ -131,7 +131,7 @@ int main(int argc, char **argv) {
131 if (getuid() != 0 && stat("/proc/sys/kernel/grsecurity", &s) == 0) { 131 if (getuid() != 0 && stat("/proc/sys/kernel/grsecurity", &s) == 0) {
132 fprintf(stderr, "Error: this feature is not available on Grsecurity systems\n"); 132 fprintf(stderr, "Error: this feature is not available on Grsecurity systems\n");
133 exit(1); 133 exit(1);
134 } 134 }
135 arg_netstats = 1; 135 arg_netstats = 1;
136 } 136 }
137 137
@@ -166,17 +166,17 @@ int main(int argc, char **argv) {
166 return 1; 166 return 1;
167 } 167 }
168 } 168 }
169 169
170 // etc 170 // etc
171 else if (strcmp(argv[i], "--nowrap") == 0) 171 else if (strcmp(argv[i], "--nowrap") == 0)
172 arg_nowrap = 1; 172 arg_nowrap = 1;
173 173
174 // invalid option 174 // invalid option
175 else if (*argv[i] == '-') { 175 else if (*argv[i] == '-') {
176 fprintf(stderr, "Error: invalid option\n"); 176 fprintf(stderr, "Error: invalid option\n");
177 return 1; 177 return 1;
178 } 178 }
179 179
180 // PID argument 180 // PID argument
181 else { 181 else {
182 // this should be a pid number 182 // this should be a pid number
@@ -199,9 +199,9 @@ int main(int argc, char **argv) {
199 fprintf(stderr, "Error: /proc is mounted hidepid, you would need to be root to run this command\n"); 199 fprintf(stderr, "Error: /proc is mounted hidepid, you would need to be root to run this command\n");
200 exit(1); 200 exit(1);
201 } 201 }
202 202
203 if (arg_top) { 203 if (arg_top) {
204 top(); 204 top();
205 return 0; 205 return 0;
206 } 206 }
207 if (arg_list) { 207 if (arg_list) {
@@ -210,9 +210,9 @@ int main(int argc, char **argv) {
210 } 210 }
211 if (arg_netstats) { 211 if (arg_netstats) {
212 netstats(); 212 netstats();
213 return 0; 213 return 0;
214 } 214 }
215 215
216 // cumulative options 216 // cumulative options
217 int print_procs = 1; 217 int print_procs = 1;
218 if (arg_tree) { 218 if (arg_tree) {
@@ -251,9 +251,9 @@ int main(int argc, char **argv) {
251 arp((pid_t) pid, print_procs); 251 arp((pid_t) pid, print_procs);
252 print_procs = 0; 252 print_procs = 0;
253 } 253 }
254 254
255 if (print_procs) 255 if (print_procs)
256 procevent((pid_t) pid); 256 procevent((pid_t) pid);
257 257
258 return 0; 258 return 0;
259} 259}