diff options
author | Ron Yorston <rmy@pobox.com> | 2020-07-09 13:10:58 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2020-07-09 13:10:58 +0100 |
commit | 9c0b2f7020d7c30b21a930ef54be632e092e533b (patch) | |
tree | b2187c40bd2fd9f49f73599fb08e52cb7a596de0 /libbb/procps.c | |
parent | a8c6e20e332a9e11a9d28cd6770eadb9c9d73cb7 (diff) | |
parent | d21a63f9fca8eb16f79de9b72d4a3484dfaec1fc (diff) | |
download | busybox-w32-9c0b2f7020d7c30b21a930ef54be632e092e533b.tar.gz busybox-w32-9c0b2f7020d7c30b21a930ef54be632e092e533b.tar.bz2 busybox-w32-9c0b2f7020d7c30b21a930ef54be632e092e533b.zip |
Merge branch 'busybox' into merge
Diffstat (limited to 'libbb/procps.c')
-rw-r--r-- | libbb/procps.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libbb/procps.c b/libbb/procps.c index e6892d7ff..4f9705bc1 100644 --- a/libbb/procps.c +++ b/libbb/procps.c | |||
@@ -178,6 +178,15 @@ static char *skip_fields(char *str, int count) | |||
178 | } | 178 | } |
179 | #endif | 179 | #endif |
180 | 180 | ||
181 | static char* skip_whitespace_if_prefixed_with(char *buf, const char *prefix) | ||
182 | { | ||
183 | char *tp = is_prefixed_with(buf, prefix); | ||
184 | if (tp) { | ||
185 | tp = skip_whitespace(tp); | ||
186 | } | ||
187 | return tp; | ||
188 | } | ||
189 | |||
181 | #if ENABLE_FEATURE_TOPMEM || ENABLE_PMAP | 190 | #if ENABLE_FEATURE_TOPMEM || ENABLE_PMAP |
182 | int FAST_FUNC procps_read_smaps(pid_t pid, struct smaprec *total, | 191 | int FAST_FUNC procps_read_smaps(pid_t pid, struct smaprec *total, |
183 | void (*cb)(struct smaprec *, void *), void *data) | 192 | void (*cb)(struct smaprec *, void *), void *data) |
@@ -208,8 +217,7 @@ int FAST_FUNC procps_read_smaps(pid_t pid, struct smaprec *total, | |||
208 | char *tp, *p; | 217 | char *tp, *p; |
209 | 218 | ||
210 | #define SCAN(S, X) \ | 219 | #define SCAN(S, X) \ |
211 | if ((tp = is_prefixed_with(buf, S)) != NULL) { \ | 220 | if ((tp = skip_whitespace_if_prefixed_with(buf, S)) != NULL) { \ |
212 | tp = skip_whitespace(tp); \ | ||
213 | total->X += currec.X = fast_strtoul_10(&tp); \ | 221 | total->X += currec.X = fast_strtoul_10(&tp); \ |
214 | continue; \ | 222 | continue; \ |
215 | } | 223 | } |