]> www.infradead.org Git - users/hch/nvme-cli.git/commitdiff
Report invalid output format for 'list' command
authorKeith Busch <kbusch@kernel.org>
Wed, 25 Sep 2019 17:26:12 +0000 (02:26 +0900)
committerKeith Busch <kbusch@kernel.org>
Wed, 25 Sep 2019 17:26:12 +0000 (02:26 +0900)
Don't fail silently if user provdies invalid 'list' options.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
nvme.c

diff --git a/nvme.c b/nvme.c
index 43000f14ca55fd085e33b319109ab672d1029e35..7bf2a50fb0947cd9223bd92d5b82a90fce0d7ee8 100644 (file)
--- a/nvme.c
+++ b/nvme.c
@@ -1399,8 +1399,10 @@ static int list(int argc, char **argv, struct command *cmd, struct plugin *plugi
                return ret;
 
        fmt = validate_output_format(cfg.output_format);
-       if (fmt != JSON && fmt != NORMAL)
+       if (fmt != JSON && fmt != NORMAL) {
+               fprintf(stderr, "Invalid output format\n");
                return -EINVAL;
+       }
 
        ret = scan_subsystems(&t);
        if (ret) {