diff options
Diffstat (limited to 'libbb/procps.c')
-rw-r--r-- | libbb/procps.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libbb/procps.c b/libbb/procps.c index 3c99ac6e7..fff9f8b0b 100644 --- a/libbb/procps.c +++ b/libbb/procps.c | |||
@@ -206,11 +206,11 @@ int FAST_FUNC procps_read_smaps(pid_t pid, struct smaprec *total, | |||
206 | // Rss: nnn kB | 206 | // Rss: nnn kB |
207 | // ..... | 207 | // ..... |
208 | 208 | ||
209 | char *tp = buf, *p; | 209 | char *tp, *p; |
210 | 210 | ||
211 | #define SCAN(S, X) \ | 211 | #define SCAN(S, X) \ |
212 | if (strncmp(tp, S, sizeof(S)-1) == 0) { \ | 212 | if ((tp = is_prefixed_with(buf, S)) != NULL) { \ |
213 | tp = skip_whitespace(tp + sizeof(S)-1); \ | 213 | tp = skip_whitespace(tp); \ |
214 | total->X += currec.X = fast_strtoul_10(&tp); \ | 214 | total->X += currec.X = fast_strtoul_10(&tp); \ |
215 | continue; \ | 215 | continue; \ |
216 | } | 216 | } |
@@ -248,7 +248,7 @@ int FAST_FUNC procps_read_smaps(pid_t pid, struct smaprec *total, | |||
248 | // skipping "rw-s FILEOFS M:m INODE " | 248 | // skipping "rw-s FILEOFS M:m INODE " |
249 | tp = skip_whitespace(skip_fields(tp, 4)); | 249 | tp = skip_whitespace(skip_fields(tp, 4)); |
250 | // filter out /dev/something (something != zero) | 250 | // filter out /dev/something (something != zero) |
251 | if (strncmp(tp, "/dev/", 5) != 0 || strcmp(tp, "/dev/zero\n") == 0) { | 251 | if (!is_prefixed_with(tp, "/dev/") || strcmp(tp, "/dev/zero\n") == 0) { |
252 | if (currec.smap_mode[1] == 'w') { | 252 | if (currec.smap_mode[1] == 'w') { |
253 | currec.mapped_rw = currec.smap_size; | 253 | currec.mapped_rw = currec.smap_size; |
254 | total->mapped_rw += currec.smap_size; | 254 | total->mapped_rw += currec.smap_size; |
@@ -498,8 +498,8 @@ procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags) | |||
498 | while (fgets(buf, sizeof(buf), file)) { | 498 | while (fgets(buf, sizeof(buf), file)) { |
499 | char *tp; | 499 | char *tp; |
500 | #define SCAN_TWO(str, name, statement) \ | 500 | #define SCAN_TWO(str, name, statement) \ |
501 | if (strncmp(buf, str, sizeof(str)-1) == 0) { \ | 501 | if ((tp = is_prefixed_with(buf, str)) != NULL) { \ |
502 | tp = skip_whitespace(buf + sizeof(str)-1); \ | 502 | tp = skip_whitespace(tp); \ |
503 | sscanf(tp, "%u", &sp->name); \ | 503 | sscanf(tp, "%u", &sp->name); \ |
504 | statement; \ | 504 | statement; \ |
505 | } | 505 | } |