]> www.infradead.org Git - users/hch/nvme-cli.git/commitdiff
nvme-cli: lnvm: add check for fd after open operation
authorMinwoo Im <minwoo.im.dev@gmail.com>
Wed, 10 Jan 2018 15:15:56 +0000 (00:15 +0900)
committerMinwoo Im <minwoo.im.dev@gmail.com>
Wed, 10 Jan 2018 15:21:43 +0000 (00:21 +0900)
Make it return negative error value when file open operation is failed.

Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
lnvm-nvme.c

index 363adeb230acbacfbd636d6e7acf112a98956188..a9322b8d6950a9bba1647fb7955660eae84f078d 100644 (file)
@@ -106,6 +106,8 @@ static int lnvm_id_ns(int argc, char **argv, struct command *cmd, struct plugin
        };
 
        fd = parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
+       if (fd < 0)
+               return fd;
 
        if (cfg.human_readable)
                flags |= HUMAN;