diff options
author | Robert Mustacchi <rm@fingolfin.org> | 2021-03-31 10:19:13 -0700 |
---|---|---|
committer | Robert Mustacchi <rm@fingolfin.org> | 2021-03-31 13:15:03 -0700 |
commit | cf988e4abd3e7fd3815aa43c51aff413cc05ad45 (patch) | |
tree | b20f4e5fc37a4c277a83fae440b57617027359c0 | |
parent | 35d41f28ed229ff7c40e0acb85ce4465390ac9bb (diff) | |
download | illumos-joyent-cf988e4abd3e7fd3815aa43c51aff413cc05ad45.tar.gz |
13690 nvmeadm get-logpage doesn't work after 13672
Reviewed by: Andy Fiddaman <andy@omnios.org>
Reviewed by: Patrick Mooney <pmooney@pfmooney.com>
-rw-r--r-- | usr/src/cmd/nvmeadm/nvmeadm.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/usr/src/cmd/nvmeadm/nvmeadm.c b/usr/src/cmd/nvmeadm/nvmeadm.c index 9caee4445b..e177e04d82 100644 --- a/usr/src/cmd/nvmeadm/nvmeadm.c +++ b/usr/src/cmd/nvmeadm/nvmeadm.c @@ -245,6 +245,7 @@ main(int argc, char **argv) nvme_process_arg_t npa = { 0 }; int help = 0; char *tmp, *lasts = NULL; + char *ctrl = NULL; while ((c = getopt(argc, argv, "dhv")) != -1) { switch (c) { @@ -303,7 +304,9 @@ main(int argc, char **argv) } /* - * All commands but "list" require a ctl/ns argument. + * All commands but "list" require a ctl/ns argument. However, this + * should not be passed through to the command in its subsequent + * arguments. */ if ((npa.npa_argc == 0 || (strncmp(npa.npa_argv[0], "nvme", 4) != 0)) && cmd->c_func != do_list) { @@ -312,11 +315,19 @@ main(int argc, char **argv) exit(-1); } + if (npa.npa_argc > 0) { + ctrl = npa.npa_argv[0]; + npa.npa_argv++; + npa.npa_argc--; + } else { + ctrl = NULL; + } + /* * Make sure we're not running commands on multiple controllers that * aren't allowed to do that. */ - if (npa.npa_argv[0] != NULL && strchr(npa.npa_argv[0], ',') != NULL && + if (ctrl != NULL && strchr(ctrl, ',') != NULL && cmd->c_multi == B_FALSE) { warnx("%s not allowed on multiple controllers", cmd->c_name); @@ -327,7 +338,7 @@ main(int argc, char **argv) /* * Get controller/namespace arguments and run command. */ - npa.npa_name = strtok_r(npa.npa_argv[0], ",", &lasts); + npa.npa_name = strtok_r(ctrl, ",", &lasts); do { if (npa.npa_name != NULL) { tmp = strchr(npa.npa_name, '/'); |