projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Detect and print when the OS doesn't support huge pages
[fio.git]
/
parse.c
diff --git
a/parse.c
b/parse.c
index bf1dea908817a5cf8530d0d76aec603173a20f47..9015b1d72bd5a527ef36ed0db12646ce01fcc945 100644
(file)
--- a/
parse.c
+++ b/
parse.c
@@
-148,8
+148,18
@@
void strip_blank_front(char **p)
void strip_blank_end(char *p)
{
void strip_blank_end(char *p)
{
- char *s = p + strlen(p) - 1;
-
+ char *s;
+
+ s = strchr(p, ';');
+ if (s)
+ *s = '\0';
+ s = strchr(p, '#');
+ if (s)
+ *s = '\0';
+ if (s)
+ p = s;
+
+ s = p + strlen(p) - 1;
while (isspace(*s) || iscntrl(*s))
s--;
while (isspace(*s) || iscntrl(*s))
s--;
@@
-452,9
+462,9
@@
int parse_option(const char *opt, struct fio_option *options, void *data)
{
struct fio_option *o;
char *pre, *post;
{
struct fio_option *o;
char *pre, *post;
- char
tmp[64]
;
+ char
*tmp
;
-
strncpy(tmp, opt, sizeof(tmp) - 1
);
+
tmp = strdup(opt
);
pre = strchr(tmp, '=');
if (pre) {
pre = strchr(tmp, '=');
if (pre) {
@@
-470,13
+480,17
@@
int parse_option(const char *opt, struct fio_option *options, void *data)
if (!o) {
fprintf(stderr, "Bad option %s\n", tmp);
if (!o) {
fprintf(stderr, "Bad option %s\n", tmp);
+ free(tmp);
return 1;
}
return 1;
}
- if (!handle_option(o, post, data))
+ if (!handle_option(o, post, data)) {
+ free(tmp);
return 0;
return 0;
+ }
fprintf(stderr, "fio: failed parsing %s\n", opt);
fprintf(stderr, "fio: failed parsing %s\n", opt);
+ free(tmp);
return 1;
}
return 1;
}