fabrics: Do not overwrite errno with return code
authorDaniel Wagner <dwagner@suse.de>
Mon, 16 Jan 2023 13:44:40 +0000 (14:44 +0100)
committerDaniel Wagner <dwagner@suse.de>
Fri, 20 Jan 2023 07:47:49 +0000 (08:47 +0100)
__create_discover_ctrl() is calling nvmf_add_ctrl() which sets errno
when something doesn't work. Hence we should not overwrite the errno
with the return code in __ctrl_discover_ctrl().

This prevents to propagate the errno code to the callside and the
nvme_strerror(errno) call is just return 'unknown error -1'.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
fabrics.c

index 5560b723d0db3e5b7436c5ffc1d20d43acc159e7..c9913f300a5216fe6045b49cf5fe368e0ab7d774 100644 (file)
--- a/fabrics.c
+++ b/fabrics.c
@@ -159,7 +159,6 @@ static nvme_ctrl_t __create_discover_ctrl(nvme_root_t r, nvme_host_t h,
 
        cfg->keep_alive_tmo = tmo;
        if (ret) {
-               errno = ret;
                nvme_free_ctrl(c);
                return NULL;
        }