diff options
Diffstat (limited to 'lib/libdevstat')
-rw-r--r-- | lib/libdevstat/devstat.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libdevstat/devstat.c b/lib/libdevstat/devstat.c index d0ba704222c5..06d214858318 100644 --- a/lib/libdevstat/devstat.c +++ b/lib/libdevstat/devstat.c @@ -1014,11 +1014,12 @@ devstat_buildmatch(char *match_str, struct devstat_match **matches, * Break the (comma delimited) input string out into separate strings. */ for (tempstr = tstr, num_args = 0; - (*tempstr = strsep(&match_str, ",")) != NULL && (num_args < 5); - num_args++) - if (**tempstr != '\0') + (*tempstr = strsep(&match_str, ",")) != NULL && (num_args < 5);) + if (**tempstr != '\0') { + num_args++; if (++tempstr >= &tstr[5]) break; + } /* The user gave us too many type arguments */ if (num_args > 3) { |