]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme: nvme write bug fix (no parse for option)
authorSteven Seungcheol Lee <sc108.lee@samsung.com>
Mon, 7 Mar 2022 09:51:11 +0000 (18:51 +0900)
committerSteven Seungcheol Lee <sc108.lee@samsung.com>
Mon, 7 Mar 2022 09:51:11 +0000 (18:51 +0900)
occured from 0adb8c2c79df953bbef9e08ce684239a5650638f
write command always print below error
data size not provided

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
nvme.c

diff --git a/nvme.c b/nvme.c
index bbaee051e3a153d69939adb3142d3fefd369e1f7..cc099ec00461743e31d90b860cf87519e936409a 100644 (file)
--- a/nvme.c
+++ b/nvme.c
@@ -6137,17 +6137,23 @@ static int submit_io(int opcode, char *command, const char *desc,
                if (fd < 0)
                        goto ret;
        } else {
+               err = argconfig_parse(argc, argv, desc, opts);
+               if (err)
+                       goto ret;
                err = fd = open_exclusive(argc, argv, cfg.force);
-               if (errno == EBUSY) {
-                       fprintf(stderr, "Failed to open %s.\n",
-                               basename(argv[optind]));
-                       fprintf(stderr,
-                               "Namespace is currently busy.\n");
-                       if (!cfg.force)
+               if (err < 0) {
+                       if (errno == EBUSY) {
+                               fprintf(stderr, "Failed to open %s.\n",
+                                       basename(argv[optind]));
                                fprintf(stderr,
-                               "Use the force [--force] option to ignore that.\n");
-               } else {
-                       argconfig_print_help(desc, opts);
+                                       "Namespace is currently busy.\n");
+                               if (!cfg.force)
+                                       fprintf(stderr,
+                                       "Use the force [--force] option to ignore that.\n");
+                       } else {
+                               argconfig_print_help(desc, opts);
+                       }
+                       goto ret;
                }
        }