projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix bad start_delay type
[fio.git]
/
parse.c
diff --git
a/parse.c
b/parse.c
index d8061610a8a92563c3701b02e8e7ee305f480ee5..1e6a5224fb4ada8897f2e6e8b901eb5c2c82d256 100644
(file)
--- a/
parse.c
+++ b/
parse.c
@@
-79,6
+79,7
@@
static void show_option_help(struct fio_option *o, FILE *out)
const char *typehelp[] = {
"invalid",
"string (opt=bla)",
const char *typehelp[] = {
"invalid",
"string (opt=bla)",
+ "string (opt=bla)",
"string with possible k/m/g postfix (opt=4k)",
"string with time postfix (opt=10s)",
"string (opt=bla)",
"string with possible k/m/g postfix (opt=4k)",
"string with time postfix (opt=10s)",
"string (opt=bla)",
@@
-167,16
+168,20
@@
static unsigned long long __get_mult_bytes(const char *p, void *data)
static unsigned long long get_mult_bytes(const char *str, int len, void *data)
{
static unsigned long long get_mult_bytes(const char *str, int len, void *data)
{
- const char *p;
+ const char *p = str;
+
+ if (len < 2)
+ return __get_mult_bytes(str, data);
+
+ /*
+ * Go forward until we hit a non-digit
+ */
+ while ((p - str) <= len) {
+ if (!isdigit(*p))
+ break;
+ p++;
+ }
- /*
- * if the last char is 'b' or 'B', the user likely used
- * "1gb" instead of just "1g". If the second to last is also
- * a letter, adjust.
- */
- p = str + len - 1;
- while (isalpha(*(p - 1)))
- p--;
if (!isalpha(*p))
p = NULL;
if (!isalpha(*p))
p = NULL;