diff options
author | 2015-08-20 10:00:28 -0400 | |
---|---|---|
committer | 2015-08-20 10:00:28 -0400 | |
commit | 5c0edb3435a07372bf89ef19e9730066aecc6b8c (patch) | |
tree | 062b9bc20a9d8f9ee9be39ce30638ca0f0266cf0 /src/firemon/top.c | |
parent | testing (diff) | |
parent | Compile with -W -Wall -Werror (diff) | |
download | firejail-5c0edb3435a07372bf89ef19e9730066aecc6b8c.tar.gz firejail-5c0edb3435a07372bf89ef19e9730066aecc6b8c.tar.zst firejail-5c0edb3435a07372bf89ef19e9730066aecc6b8c.zip |
Merge pull request #35 from pmillerchip/warnings-cleanup
Compile with -W -Wall -Werror
Diffstat (limited to 'src/firemon/top.c')
-rw-r--r-- | src/firemon/top.c | 11 |
1 files changed, 7 insertions, 4 deletions
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) |