projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix crash on specifying bad IO engine on the command line
[fio.git]
/
init.c
diff --git
a/init.c
b/init.c
index aa31138c155b86f70315a375071e1a58c9d821f3..26e42ef64fd018c1219f8112929fbd7f91f8a942 100644
(file)
--- a/
init.c
+++ b/
init.c
@@
-22,7
+22,7
@@
#include "lib/getopt.h"
#include "lib/getopt.h"
-static char fio_version_string[] = "fio 1.5
2
";
+static char fio_version_string[] = "fio 1.5
3
";
#define FIO_RANDSEED (0xb1899bedUL)
#define FIO_RANDSEED (0xb1899bedUL)
@@
-64,82
+64,82
@@
static char cmd_optstr[256];
*/
static struct option l_opts[FIO_NR_OPTIONS] = {
{
*/
static struct option l_opts[FIO_NR_OPTIONS] = {
{
- .name = "output",
+ .name =
(char *)
"output",
.has_arg = required_argument,
.val = 'o',
},
{
.has_arg = required_argument,
.val = 'o',
},
{
- .name = "timeout",
+ .name =
(char *)
"timeout",
.has_arg = required_argument,
.val = 't',
},
{
.has_arg = required_argument,
.val = 't',
},
{
- .name = "latency-log",
+ .name =
(char *)
"latency-log",
.has_arg = required_argument,
.val = 'l',
},
{
.has_arg = required_argument,
.val = 'l',
},
{
- .name = "bandwidth-log",
+ .name =
(char *)
"bandwidth-log",
.has_arg = required_argument,
.val = 'b',
},
{
.has_arg = required_argument,
.val = 'b',
},
{
- .name = "minimal",
+ .name =
(char *)
"minimal",
.has_arg = optional_argument,
.val = 'm',
},
{
.has_arg = optional_argument,
.val = 'm',
},
{
- .name = "version",
+ .name =
(char *)
"version",
.has_arg = no_argument,
.val = 'v',
},
{
.has_arg = no_argument,
.val = 'v',
},
{
- .name = "help",
+ .name =
(char *)
"help",
.has_arg = no_argument,
.val = 'h',
},
{
.has_arg = no_argument,
.val = 'h',
},
{
- .name = "cmdhelp",
+ .name =
(char *)
"cmdhelp",
.has_arg = optional_argument,
.val = 'c',
},
{
.has_arg = optional_argument,
.val = 'c',
},
{
- .name = "showcmd",
+ .name =
(char *)
"showcmd",
.has_arg = no_argument,
.val = 's',
},
{
.has_arg = no_argument,
.val = 's',
},
{
- .name = "readonly",
+ .name =
(char *)
"readonly",
.has_arg = no_argument,
.val = 'r',
},
{
.has_arg = no_argument,
.val = 'r',
},
{
- .name = "eta",
+ .name =
(char *)
"eta",
.has_arg = required_argument,
.val = 'e',
},
{
.has_arg = required_argument,
.val = 'e',
},
{
- .name = "debug",
+ .name =
(char *)
"debug",
.has_arg = required_argument,
.val = 'd',
},
{
.has_arg = required_argument,
.val = 'd',
},
{
- .name = "section",
+ .name =
(char *)
"section",
.has_arg = required_argument,
.val = 'x',
},
{
.has_arg = required_argument,
.val = 'x',
},
{
- .name = "alloc-size",
+ .name =
(char *)
"alloc-size",
.has_arg = required_argument,
.val = 'a',
},
{
.has_arg = required_argument,
.val = 'a',
},
{
- .name = "profile",
+ .name =
(char *)
"profile",
.has_arg = required_argument,
.val = 'p',
},
{
.has_arg = required_argument,
.val = 'p',
},
{
- .name = "warnings-fatal",
+ .name =
(char *)
"warnings-fatal",
.has_arg = no_argument,
.val = 'w',
},
.has_arg = no_argument,
.val = 'w',
},
@@
-191,7
+191,7
@@
static void put_job(struct thread_data *td)
{
if (td == &def_thread)
return;
{
if (td == &def_thread)
return;
-
+
profile_td_exit(td);
if (td->error)
profile_td_exit(td);
if (td->error)
@@
-568,7
+568,7
@@
static int add_job(struct thread_data *td, const char *jobname, int job_add_num)
}
if (profile_td_init(td))
}
if (profile_td_init(td))
-
return 1
;
+
goto err
;
engine = get_engine_name(td->o.ioengine);
td->io_ops = load_ioengine(td, engine);
engine = get_engine_name(td->o.ioengine);
td->io_ops = load_ioengine(td, engine);
@@
-835,7
+835,7
@@
static int parse_jobs_ini(char *file, int stonewall_flag)
if (is_empty_or_comment(p))
continue;
if (is_empty_or_comment(p))
continue;
- if (sscanf(p, "[%255
s
]", name) != 1) {
+ if (sscanf(p, "[%255
[^\n]
]", name) != 1) {
if (inside_skip)
continue;
log_err("fio: option <%s> outside of [] job section\n",
if (inside_skip)
continue;
log_err("fio: option <%s> outside of [] job section\n",
@@
-1222,10
+1222,8
@@
static int parse_cmd_line(int argc, char *argv[])
if (!strncmp(opt, "name", 4) && td) {
ret = add_job(td, td->o.name ?: "fio", 0);
if (!strncmp(opt, "name", 4) && td) {
ret = add_job(td, td->o.name ?: "fio", 0);
- if (ret) {
- put_job(td);
+ if (ret)
return 0;
return 0;
- }
td = NULL;
}
if (!td) {
td = NULL;
}
if (!td) {
@@
-1262,8
+1260,6
@@
static int parse_cmd_line(int argc, char *argv[])
if (td) {
if (!ret)
ret = add_job(td, td->o.name ?: "fio", 0);
if (td) {
if (!ret)
ret = add_job(td, td->o.name ?: "fio", 0);
- if (ret)
- put_job(td);
}
while (optind < argc) {
}
while (optind < argc) {