summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2020-10-28 17:28:48 +0000
committerAlexander Motin <mav@FreeBSD.org>2020-10-28 17:28:48 +0000
commit8f92938fab14f0ce6584ecece99e420aa69e4db7 (patch)
treea2f140823513d26341a52771591e066af75e1164 /sbin
parente4c79332a04cdcab2f81b4903864643278a10044 (diff)
downloadsrc-test2-8f92938fab14f0ce6584ecece99e420aa69e4db7.tar.gz
src-test2-8f92938fab14f0ce6584ecece99e420aa69e4db7.zip
Use proper variable for device path.
It seems *-passthru commands were broken from the day one, since the device path is fetched into opt.dev variable and not left in argv[optind]. The other three wrong argv[optind] instances are just in error messages. MFC after: 1 week Sponsored by: iXsystems, Inc.
Notes
Notes: svn path=/head/; revision=367112
Diffstat (limited to 'sbin')
-rw-r--r--sbin/nvmecontrol/ns.c4
-rw-r--r--sbin/nvmecontrol/passthru.c2
-rw-r--r--sbin/nvmecontrol/reset.c2
3 files changed, 4 insertions, 4 deletions
diff --git a/sbin/nvmecontrol/ns.c b/sbin/nvmecontrol/ns.c
index 10424a6063ce..0e8589fdc140 100644
--- a/sbin/nvmecontrol/ns.c
+++ b/sbin/nvmecontrol/ns.c
@@ -605,7 +605,7 @@ nscreate(const struct cmd *f, int argc, char *argv[])
pt.len = sizeof(struct nvme_namespace_data);
pt.is_read = 0; /* passthrough writes data to ctrlr */
if ((result = ioctl(fd, NVME_PASSTHROUGH_CMD, &pt)) < 0)
- errx(1, "ioctl request to %s failed: %d", argv[optind], result);
+ errx(1, "ioctl request to %s failed: %d", create_opt.dev, result);
if (nvme_completion_is_error(&pt.cpl)) {
errx(1, "namespace creation failed: %s",
@@ -822,7 +822,7 @@ nsdetach(const struct cmd *f, int argc, char *argv[])
pt.len = sizeof(clist);
if ((result = ioctl(fd, NVME_PASSTHROUGH_CMD, &pt)) < 0)
- errx(1, "ioctl request to %s failed: %d", argv[optind], result);
+ errx(1, "ioctl request to %s failed: %d", detach_opt.dev, result);
if (nvme_completion_is_error(&pt.cpl)) {
errx(1, "namespace detach failed: %s",
diff --git a/sbin/nvmecontrol/passthru.c b/sbin/nvmecontrol/passthru.c
index 87ba322ca3c3..abdee4ef5f88 100644
--- a/sbin/nvmecontrol/passthru.c
+++ b/sbin/nvmecontrol/passthru.c
@@ -164,7 +164,7 @@ passthru(const struct cmd *f, int argc, char *argv[])
if (arg_parse(argc, argv, f))
return;
- open_dev(argv[optind], &fd, 1, 1);
+ open_dev(opt.dev, &fd, 1, 1);
if (opt.read && opt.write)
errx(1, "need exactly one of --read or --write");
diff --git a/sbin/nvmecontrol/reset.c b/sbin/nvmecontrol/reset.c
index 1bf45a43c2d7..89e64c603b01 100644
--- a/sbin/nvmecontrol/reset.c
+++ b/sbin/nvmecontrol/reset.c
@@ -70,7 +70,7 @@ reset(const struct cmd *f, int argc, char *argv[])
free(path);
if (ioctl(fd, NVME_RESET_CONTROLLER) < 0)
- err(1, "reset request to %s failed", argv[optind]);
+ err(1, "reset request to %s failed", opt.dev);
exit(0);
}