Blob Blame History Raw
commit 9ec18159f75512687a3df22eee15fbafc4c87c9a
Author: Tomas Bzatek <tbzatek@redhat.com>
Date:   Mon Mar 14 18:15:20 2022 +0100

    connect: Set errno to zero on nvmf_add_ctrl() success
    
    The libnvme's nvmf_add_ctrl() might return zero (success) while
    having errno set to a non-zero value due to lots of calls inside.
    And since nvmf_connect() returns errno primarily, make sure
    it's zeroed on success.
    
    See related https://github.com/linux-nvme/libnvme/pull/292

diff --git a/fabrics.c b/fabrics.c
index 49378dc..e08ffd6 100644
--- a/fabrics.c
+++ b/fabrics.c
@@ -688,6 +688,7 @@ int nvmf_connect(const char *desc, int argc, char **argv)
 		fprintf(stderr, "no controller found: %s\n",
 			nvme_strerror(errno));
 	else {
+		errno = 0;
 		if (flags == NORMAL)
 			print_connect_msg(c);
 		else if (flags == JSON)