Fix broken FIO_OPT_STR option
authorJens Axboe <jens.axboe@oracle.com>
Wed, 10 Mar 2010 11:49:03 +0000 (12:49 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Wed, 10 Mar 2010 11:49:03 +0000 (12:49 +0100)
Only break out and show help if the option had ->posval entries.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
parse.c

diff --git a/parse.c b/parse.c
index cbe8e35f2bd7e9fc5c5785c5d2afe77c95f341ca..fb5d45798d2bdf933ffb20beb87cb49d641d49c4 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -289,7 +289,7 @@ static int __handle_option(struct fio_option *o, const char *ptr, void *data,
                fio_opt_str_fn *fn = o->cb;
                const struct value_pair *vp;
                struct value_pair posval[PARSE_MAX_VP];
-               int i;
+               int i, all_skipped = 1;
 
                posval_sort(o, posval);
 
@@ -298,6 +298,7 @@ static int __handle_option(struct fio_option *o, const char *ptr, void *data,
                        vp = &posval[i];
                        if (!vp->ival || vp->ival[0] == '\0')
                                continue;
+                       all_skipped = 0;
                        if (!strncmp(vp->ival, ptr, strlen(vp->ival))) {
                                ret = 0;
                                if (o->roff1) {
@@ -314,7 +315,7 @@ static int __handle_option(struct fio_option *o, const char *ptr, void *data,
                        }
                }
 
-               if (ret)
+               if (ret && !all_skipped)
                        show_option_values(o);
                else if (fn)
                        ret = fn(data, ptr);