From: Keith Busch Date: Mon, 27 Feb 2017 15:31:38 +0000 (-0500) Subject: get-ns-id: Exit when no device provided. X-Git-Tag: v1.2~13 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=8ebd39bf06155e2fc893dacf42803c1f6cb94219;p=users%2Fsagi%2Fnvme-cli.git get-ns-id: Exit when no device provided. https://github.com/linux-nvme/nvme-cli/issues/159 Signed-off-by: Keith Busch --- diff --git a/nvme.c b/nvme.c index be5ec834..a6651ca5 100644 --- a/nvme.c +++ b/nvme.c @@ -1034,7 +1034,9 @@ static int get_ns_id(int argc, char **argv, struct command *cmd, struct plugin * { int nsid, fd; - fd = open_dev(argv[1]); + fd = get_dev(argc, argv); + if (fd < 0) + return fd; nsid = nvme_get_nsid(fd); if (nsid <= 0) { perror(devicename);