projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix bug in parser with postfix and truncated direction values
[fio.git]
/
parse.c
diff --git
a/parse.c
b/parse.c
index 7dc5fcc869ff05b21accb95257bb4fa473d188f3..c2d744b3088f5a4d74f1e94e9ea9631f9b2859e4 100644
(file)
--- a/
parse.c
+++ b/
parse.c
@@
-430,12
+430,16
@@
static int __handle_option(struct fio_option *o, const char *ptr, void *data,
return ret;
}
return ret;
}
-static int handle_option(struct fio_option *o, const char *ptr, void *data)
+static int handle_option(struct fio_option *o, const char *
__
ptr, void *data)
{
{
- c
onst char
*ptr2 = NULL;
+ c
har *ptr,
*ptr2 = NULL;
int r1, r2;
int r1, r2;
- dprint(FD_PARSE, "handle_option=%s, ptr=%s\n", o->name, ptr);
+ dprint(FD_PARSE, "handle_option=%s, ptr=%s\n", o->name, __ptr);
+
+ ptr = NULL;
+ if (__ptr)
+ ptr = strdup(__ptr);
/*
* See if we have a second set of parameters, hidden after a comma.
/*
* See if we have a second set of parameters, hidden after a comma.
@@
-446,6
+450,8
@@
static int handle_option(struct fio_option *o, const char *ptr, void *data)
(o->type != FIO_OPT_STR_STORE) &&
(o->type != FIO_OPT_STR)) {
ptr2 = strchr(ptr, ',');
(o->type != FIO_OPT_STR_STORE) &&
(o->type != FIO_OPT_STR)) {
ptr2 = strchr(ptr, ',');
+ if (ptr2 && *(ptr2 + 1) == '\0')
+ *ptr2 = '\0';
if (!ptr2)
ptr2 = strchr(ptr, ':');
if (!ptr2)
if (!ptr2)
ptr2 = strchr(ptr, ':');
if (!ptr2)
@@
-459,12
+465,17
@@
static int handle_option(struct fio_option *o, const char *ptr, void *data)
*/
r1 = __handle_option(o, ptr, data, 1, !!ptr2);
*/
r1 = __handle_option(o, ptr, data, 1, !!ptr2);
- if (!ptr2)
+ if (!ptr2) {
+ if (ptr)
+ free(ptr);
return r1;
return r1;
+ }
ptr2++;
r2 = __handle_option(o, ptr2, data, 0, 0);
ptr2++;
r2 = __handle_option(o, ptr2, data, 0, 0);
+ if (ptr)
+ free(ptr);
return r1 && r2;
}
return r1 && r2;
}