diff options
author | Peter Millerchip <pete@millerchipsoftware.com> | 2015-08-20 14:38:44 +0100 |
---|---|---|
committer | Peter Millerchip <pete@millerchipsoftware.com> | 2015-08-20 14:38:44 +0100 |
commit | 48af0110f88d63bc351579974ceafde352ebe8e2 (patch) | |
tree | 806b45a3c1ab0c7e676b5168ee84f2dfd743bd8f /src/firemon | |
parent | Merge pull request #34 from pmillerchip/make-install (diff) | |
download | firejail-48af0110f88d63bc351579974ceafde352ebe8e2.tar.gz firejail-48af0110f88d63bc351579974ceafde352ebe8e2.tar.zst firejail-48af0110f88d63bc351579974ceafde352ebe8e2.zip |
Compile with -W -Wall -Werror
Diffstat (limited to 'src/firemon')
-rw-r--r-- | src/firemon/Makefile.in | 2 | ||||
-rw-r--r-- | src/firemon/firemon.c | 3 | ||||
-rw-r--r-- | src/firemon/netstats.c | 2 | ||||
-rw-r--r-- | src/firemon/top.c | 11 |
4 files changed, 12 insertions, 6 deletions
diff --git a/src/firemon/Makefile.in b/src/firemon/Makefile.in index 425289695..56c25ee18 100644 --- a/src/firemon/Makefile.in +++ b/src/firemon/Makefile.in | |||
@@ -8,7 +8,7 @@ H_FILE_LIST = $(wildcard *.[h]) | |||
8 | C_FILE_LIST = $(wildcard *.c) | 8 | C_FILE_LIST = $(wildcard *.c) |
9 | OBJS = $(C_FILE_LIST:.c=.o) | 9 | OBJS = $(C_FILE_LIST:.c=.o) |
10 | BINOBJS = $(foreach file, $(OBJS), $file) | 10 | BINOBJS = $(foreach file, $(OBJS), $file) |
11 | CFLAGS += -ggdb -O2 -DVERSION='"$(VERSION)"' -fstack-protector-all -D_FORTIFY_SOURCE=2 -fPIE -pie -Wformat -Wformat-security | 11 | CFLAGS += -ggdb -W -Wall -Werror -O2 -DVERSION='"$(VERSION)"' -fstack-protector-all -D_FORTIFY_SOURCE=2 -fPIE -pie -Wformat -Wformat-security |
12 | LDFLAGS += -pie -Wl,-z,relro -Wl,-z,now | 12 | LDFLAGS += -pie -Wl,-z,relro -Wl,-z,now |
13 | 13 | ||
14 | %.o : %.c $(H_FILE_LIST) | 14 | %.o : %.c $(H_FILE_LIST) |
diff --git a/src/firemon/firemon.c b/src/firemon/firemon.c index d77d11a7a..d3c89651e 100644 --- a/src/firemon/firemon.c +++ b/src/firemon/firemon.c | |||
@@ -40,6 +40,9 @@ static struct termios twait; // no wait on key press | |||
40 | static int terminal_set = 0; | 40 | static int terminal_set = 0; |
41 | 41 | ||
42 | static void my_handler(int s){ | 42 | static void my_handler(int s){ |
43 | // Remove unused parameter warning | ||
44 | (void)s; | ||
45 | |||
43 | if (terminal_set) | 46 | if (terminal_set) |
44 | tcsetattr(0, TCSANOW, &tlocal); | 47 | tcsetattr(0, TCSANOW, &tlocal); |
45 | exit(0); | 48 | exit(0); |
diff --git a/src/firemon/netstats.c b/src/firemon/netstats.c index 6c4a767f1..3f1e00ee9 100644 --- a/src/firemon/netstats.c +++ b/src/firemon/netstats.c | |||
@@ -195,7 +195,7 @@ void netstats(void) { | |||
195 | // start printing | 195 | // start printing |
196 | firemon_clrscr(); | 196 | firemon_clrscr(); |
197 | char *header = get_header(); | 197 | char *header = get_header(); |
198 | if (strlen(header) > col) | 198 | if (strlen(header) > (size_t)col) |
199 | header[col] = '\0'; | 199 | header[col] = '\0'; |
200 | printf("%s\n", header); | 200 | printf("%s\n", header); |
201 | if (row > 0) | 201 | if (row > 0) |
diff --git a/src/firemon/top.c b/src/firemon/top.c index 1eb753694..8de3ee6b5 100644 --- a/src/firemon/top.c +++ b/src/firemon/top.c | |||
@@ -42,7 +42,10 @@ static char *get_header(void) { | |||
42 | // recursivity!!! | 42 | // recursivity!!! |
43 | static char *print_top(unsigned index, unsigned parent, unsigned *utime, unsigned *stime, unsigned itv, float *cpu, int *cnt) { | 43 | static char *print_top(unsigned index, unsigned parent, unsigned *utime, unsigned *stime, unsigned itv, float *cpu, int *cnt) { |
44 | char *rv = NULL; | 44 | char *rv = NULL; |
45 | 45 | ||
46 | // Remove unused parameter warning | ||
47 | (void)parent; | ||
48 | |||
46 | char procdir[20]; | 49 | char procdir[20]; |
47 | snprintf(procdir, 20, "/proc/%u", index); | 50 | snprintf(procdir, 20, "/proc/%u", index); |
48 | struct stat s; | 51 | struct stat s; |
@@ -68,7 +71,7 @@ static char *print_top(unsigned index, unsigned parent, unsigned *utime, unsigne | |||
68 | 71 | ||
69 | int i; | 72 | int i; |
70 | for (i = index + 1; i < max_pids; i++) { | 73 | for (i = index + 1; i < max_pids; i++) { |
71 | if (pids[i].parent == index) | 74 | if (pids[i].parent == (pid_t)index) |
72 | print_top(i, index, utime, stime, itv, cpu, cnt); | 75 | print_top(i, index, utime, stime, itv, cpu, cnt); |
73 | } | 76 | } |
74 | 77 | ||
@@ -213,7 +216,7 @@ void head_print(int col, int row) { | |||
213 | if (current >= row) | 216 | if (current >= row) |
214 | break; | 217 | break; |
215 | 218 | ||
216 | if (strlen(ptr->line) > col) | 219 | if (strlen(ptr->line) > (size_t)col) |
217 | ptr->line[col] = '\0'; | 220 | ptr->line[col] = '\0'; |
218 | 221 | ||
219 | if (ptr->next == NULL || current == (row - 1)) { | 222 | if (ptr->next == NULL || current == (row - 1)) { |
@@ -264,7 +267,7 @@ void top(void) { | |||
264 | // start printing | 267 | // start printing |
265 | firemon_clrscr(); | 268 | firemon_clrscr(); |
266 | char *header = get_header(); | 269 | char *header = get_header(); |
267 | if (strlen(header) > col) | 270 | if (strlen(header) > (size_t)col) |
268 | header[col] = '\0'; | 271 | header[col] = '\0'; |
269 | printf("%s\n", header); | 272 | printf("%s\n", header); |
270 | if (row > 0) | 273 | if (row > 0) |