File 0005-nvme-ioctl-return-1-on-failure-from-nvme_get_nsid.patch of Package nvme-cli.26915

From: Hannes Reinecke <hare@suse.de>
Date: Tue, 22 Jun 2021 13:40:23 +0200
Subject: nvme-ioctl: return -1 on failure from nvme_get_nsid()
References: bsc#1186719
Git-commit: 22c19f6a5b58ad9ce99d2c2a95239eab911d908e

If the call to 'fstat' fails we should be returning '-1' (as the
errno is already set by fstat()) to be compliant with the return
values from 'ioctl()'.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 nvme-ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nvme-ioctl.c b/nvme-ioctl.c
index cc12ae60d06d..64152b1cfd0c 100644
--- a/nvme-ioctl.c
+++ b/nvme-ioctl.c
@@ -68,7 +68,7 @@ int nvme_get_nsid(int fd)
 	int err = fstat(fd, &nvme_stat);
 
 	if (err < 0)
-		return -errno;
+		return err;
 
 	return ioctl(fd, NVME_IOCTL_ID);
 }
-- 
2.32.0

openSUSE Build Service is sponsored by