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