]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme-cli: add error message for nvme list.
authorChaitanya Kulkarni <chaitanya.kulkarni@hgst.com>
Mon, 26 Jun 2017 20:59:08 +0000 (13:59 -0700)
committerChaitanya Kulkarni <chaitanya.kulkarni@hgst.com>
Mon, 26 Jun 2017 20:59:08 +0000 (13:59 -0700)
Print error message for "nvme list" command when NVMe device(s)
is not present.

nvme.c

diff --git a/nvme.c b/nvme.c
index f746b74408c1257f48e6ee14dbdb3c7cd0cf59c7..6a5449848957a00d4aef1869b6d7342f00fef7e7 100644 (file)
--- a/nvme.c
+++ b/nvme.c
@@ -836,8 +836,10 @@ static int list(int argc, char **argv, struct command *cmd, struct plugin *plugi
                return -EINVAL;
 
        n = scandir(dev, &devices, scan_dev_filter, alphasort);
-       if (n < 0)
+       if (n < 0) {
+               fprintf(stderr, "no NVMe device(s) detected.\n");
                return n;
+       }
 
        list_items = calloc(n, sizeof(*list_items));
        if (!list_items) {