projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[PATCH] Fix random_map
[fio.git]
/
parse.c
diff --git
a/parse.c
b/parse.c
index e001eef4224f554ec3605c9ed9353ceb19af1395..9f2ee0d653c7fcdc781caa4eea1a46eee4776074 100644
(file)
--- a/
parse.c
+++ b/
parse.c
@@
-93,7
+93,7
@@
void strip_blank_end(char *p)
*(s + 1) = '\0';
}
*(s + 1) = '\0';
}
-static int check_range_bytes(char *str, unsigned long *val)
+static int check_range_bytes(c
onst c
har *str, unsigned long *val)
{
char suffix;
{
char suffix;
@@
-175,9
+175,12
@@
static int handle_option(struct fio_option *o, const char *ptr, void *data)
*cp = strdup(ptr);
break;
case FIO_OPT_RANGE: {
*cp = strdup(ptr);
break;
case FIO_OPT_RANGE: {
+ char tmp[128];
char *p1, *p2;
char *p1, *p2;
- p1 = strchr(ptr, '-');
+ strncpy(tmp, ptr, sizeof(tmp) - 1);
+
+ p1 = strchr(tmp, '-');
if (!p1) {
ret = 1;
break;
if (!p1) {
ret = 1;
break;
@@
-185,7
+188,7
@@
static int handle_option(struct fio_option *o, const char *ptr, void *data)
p2 = p1 + 1;
*p1 = '\0';
p2 = p1 + 1;
*p1 = '\0';
- p1 =
ptr
;
+ p1 =
tmp
;
ret = 1;
if (!check_range_bytes(p1, &ul1) && !check_range_bytes(p2, &ul2)) {
ret = 1;
if (!check_range_bytes(p1, &ul1) && !check_range_bytes(p2, &ul2)) {
@@
-251,7
+254,11
@@
int parse_cmd_option(const char *opt, const char *val,
return 1;
}
return 1;
}
- return handle_option(o, val, data);
+ if (!handle_option(o, val, data))
+ return 0;
+
+ fprintf(stderr, "fio: failed parsing %s=%s\n", opt, val);
+ return 1;
}
int parse_option(const char *opt, struct fio_option *options, void *data)
}
int parse_option(const char *opt, struct fio_option *options, void *data)
@@
-260,7
+267,7
@@
int parse_option(const char *opt, struct fio_option *options, void *data)
char *pre, *post;
char tmp[64];
char *pre, *post;
char tmp[64];
- str
cpy(tmp, opt
);
+ str
ncpy(tmp, opt, sizeof(tmp) - 1
);
pre = strchr(tmp, '=');
if (pre) {
pre = strchr(tmp, '=');
if (pre) {
@@
-279,5
+286,9
@@
int parse_option(const char *opt, struct fio_option *options, void *data)
return 1;
}
return 1;
}
- return handle_option(o, post, data);
+ if (!handle_option(o, post, data))
+ return 0;
+
+ fprintf(stderr, "fio: failed parsing %s\n", opt);
+ return 1;
}
}