]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme: get_ns_id command fails on nvme device
authorMartin George <marting@netapp.com>
Mon, 21 Feb 2022 05:09:14 +0000 (10:39 +0530)
committerMartin George <marting@netapp.com>
Mon, 21 Feb 2022 05:09:14 +0000 (10:39 +0530)
The get-ns-id command currently prints the perror status for a
given nvme device rather than its nsid. Fix this by properly
checking the return status of the nvme_get_nsid() function.

Signed-off-by: Martin George <marting@netapp.com>
nvme.c

diff --git a/nvme.c b/nvme.c
index cf04a9ae04c47484c6405ff918cf063254f90b98..5e9e5cdadea63d907a9891a622904308a9e7b441 100644 (file)
--- a/nvme.c
+++ b/nvme.c
@@ -3256,7 +3256,7 @@ static int get_ns_id(int argc, char **argv, struct command *cmd, struct plugin *
                goto ret;
 
        err = nvme_get_nsid(fd, &nsid);
-       if (err <= 0) {
+       if (err < 0) {
                fprintf(stderr, "get namespace ID: %s\n", nvme_strerror(errno));
                err = errno;
                goto close_fd;