diff options
author | Dan McDonald <danmcd@joyent.com> | 2021-04-01 11:17:01 -0400 |
---|---|---|
committer | Dan McDonald <danmcd@joyent.com> | 2021-04-01 11:17:01 -0400 |
commit | 4a123e1ae5cca7823d90e2a35522142f86eacc8a (patch) | |
tree | 98fa52e63e6a9a4f67e8beb9044865f8fc8e3385 | |
parent | f2739712dfa5da3abbd7592fc410a479c3df7ff0 (diff) | |
parent | cf988e4abd3e7fd3815aa43c51aff413cc05ad45 (diff) | |
download | illumos-joyent-4a123e1ae5cca7823d90e2a35522142f86eacc8a.tar.gz |
[illumos-gate merge]
commit cf988e4abd3e7fd3815aa43c51aff413cc05ad45
13690 nvmeadm get-logpage doesn't work after 13672
-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, '/'); |