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--;
{
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) {
if (!o) {
fprintf(stderr, "Bad option %s\n", tmp);
+ free(tmp);
return 1;
}
- if (!handle_option(o, post, data))
+ if (!handle_option(o, post, data)) {
+ free(tmp);
return 0;
+ }
fprintf(stderr, "fio: failed parsing %s\n", opt);
+ free(tmp);
return 1;
}