From: Jens Axboe Date: Tue, 21 Nov 2006 12:15:10 +0000 (+0100) Subject: [PATCH] Don't segfault on missing argument data X-Git-Tag: fio-1.10~27 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=08e26e3579fdae51cc9aafc71a80c638563bf2cd;ds=sidebyside [PATCH] Don't segfault on missing argument data Signed-off-by: Jens Axboe --- diff --git a/parse.c b/parse.c index 869b3dbf..8cd427a9 100644 --- a/parse.c +++ b/parse.c @@ -154,6 +154,11 @@ static int __handle_option(struct fio_option *o, const char *ptr, void *data, char **cp; int ret = 0, is_time = 0; + if (!ptr && o->type != FIO_OPT_STR_SET) { + fprintf(stderr, "Option %s requires an argument\n", o->name); + return 1; + } + switch (o->type) { case FIO_OPT_STR: { fio_opt_str_fn *fn = o->cb;