If we attempt to do number conversion, and strtoll() returns 0 AND
the end pointer is the same as the starting string, then fail the
conversion.
Fixes: https://github.com/axboe/fio/issues/841
Signed-off-by: Jens Axboe <axboe@kernel.dk>
#endif
if (rc == 1) {
+ char *endptr;
+
if (strstr(str, "0x") || strstr(str, "0X"))
base = 16;
else
base = 10;
- *val = strtoll(str, NULL, base);
+ *val = strtoll(str, &endptr, base);
+ if (*val == 0 && endptr == str)
+ return 1;
if (*val == LONG_MAX && errno == ERANGE)
return 1;
}