From adb4bd8e2c75d8b7a4fb20eb8c3518398be929a7 Mon Sep 17 00:00:00 2001 From: jimharris Date: Tue, 9 Jul 2013 21:33:12 +0000 Subject: 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 --- sbin/nvmecontrol/identify.c | 4 ++++ sbin/nvmecontrol/nvmecontrol.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'sbin') 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 \n" +" nvmecontrol identify [-x [-v]] \n" #define PERFTEST_USAGE \ " nvmecontrol perftest <-n num_threads> <-o read|write>\n" \ -- cgit v1.1