Better parser fix
[fio.git] / parse.c
diff --git a/parse.c b/parse.c
index 2dee446d7a8a2ad0614e37c4a5bd09796f5e296d..f52139f5cb0eff2cf85ca10b99db743b567ef174 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -187,6 +187,7 @@ static unsigned long long get_mult_bytes(const char *str, int len, void *data,
                                         int *percent)
 {
        const char *p = str;
+       int digit_seen = 0;
 
        if (len < 2)
                return __get_mult_bytes(str, data, percent);
@@ -195,8 +196,10 @@ static unsigned long long get_mult_bytes(const char *str, int len, void *data,
          * Go forward until we hit a non-digit, or +/- sign
          */
        while ((p - str) <= len) {
-               if (!isdigit((int) *p) && (*p != '+') && (*p != '-'))
+               if (!isdigit((int) *p) &&
+                   (((*p != '+') && (*p != '-')) || digit_seen))
                        break;
+               digit_seen |= isdigit(*p);
                p++;
        }