summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjimharris <jimharris@FreeBSD.org>2013-07-09 21:33:12 +0000
committerjimharris <jimharris@FreeBSD.org>2013-07-09 21:33:12 +0000
commitadb4bd8e2c75d8b7a4fb20eb8c3518398be929a7 (patch)
tree8d576638450d8e48d186ecc7ca69456a1b615a39
parentdc13e388c88acb97133f1c3e9e81cb561ee239af (diff)
downloadFreeBSD-src-adb4bd8e2c75d8b7a4fb20eb8c3518398be929a7.zip
FreeBSD-src-adb4bd8e2c75d8b7a4fb20eb8c3518398be929a7.tar.gz
Ensure controller or namespace node name is specified before trying to
access it. While here, also fix the identify usage message to show the -v and -x parameters. Sponsored by: Intel MFC after: 3 days
-rw-r--r--sbin/nvmecontrol/identify.c4
-rw-r--r--sbin/nvmecontrol/nvmecontrol.h2
2 files changed, 5 insertions, 1 deletions
diff --git a/sbin/nvmecontrol/identify.c b/sbin/nvmecontrol/identify.c
index ab6b85f..7cc499c 100644
--- a/sbin/nvmecontrol/identify.c
+++ b/sbin/nvmecontrol/identify.c
@@ -259,6 +259,10 @@ identify(int argc, char *argv[])
while (getopt(argc, argv, "vx") != -1) ;
+ /* Check that a controller or namespace was specified. */
+ if (optind >= argc)
+ identify_usage();
+
target = argv[optind];
optreset = 1;
diff --git a/sbin/nvmecontrol/nvmecontrol.h b/sbin/nvmecontrol/nvmecontrol.h
index 99075f6..8401dd7 100644
--- a/sbin/nvmecontrol/nvmecontrol.h
+++ b/sbin/nvmecontrol/nvmecontrol.h
@@ -38,7 +38,7 @@
" nvmecontrol devlist\n"
#define IDENTIFY_USAGE \
-" nvmecontrol identify <controller id|namespace id>\n"
+" nvmecontrol identify [-x [-v]] <controller id|namespace id>\n"
#define PERFTEST_USAGE \
" nvmecontrol perftest <-n num_threads> <-o read|write>\n" \
OpenPOWER on IntegriCloud