]> www.infradead.org Git - users/sagi/libnvme.git/commitdiff
fabrics: Fix build_options() return values
authorTomas Bzatek <tbzatek@redhat.com>
Thu, 28 Jul 2022 16:41:15 +0000 (18:41 +0200)
committerTomas Bzatek <tbzatek@redhat.com>
Thu, 28 Jul 2022 16:41:15 +0000 (18:41 +0200)
Make the returned error values consistent with the rest of the code.

src/nvme/fabrics.c

index ee20da2ff7130df1651a636f34b5bdcf8773e2a5..b68b7b94965ccaa8a1229a981cbbaeb9a2172b68 100644 (file)
@@ -438,20 +438,23 @@ static int build_options(nvme_host_t h, nvme_ctrl_t c, char **argstr)
 
        if (!transport) {
                nvme_msg(h->r, LOG_ERR, "need a transport (-t) argument\n");
-               return -ENVME_CONNECT_TARG;
+               errno = ENVME_CONNECT_TARG;
+               return -1;
        }
 
        if (strncmp(transport, "loop", 4)) {
                if (!nvme_ctrl_get_traddr(c)) {
                        nvme_msg(h->r, LOG_ERR, "need a address (-a) argument\n");
-                       return -ENVME_CONNECT_AARG;
+                       errno = ENVME_CONNECT_AARG;
+                       return -1;
                }
        }
 
        /* always specify nqn as first arg - this will init the string */
        if (asprintf(argstr, "nqn=%s",
                     nvme_ctrl_get_subsysnqn(c)) < 0) {
-               return -ENOMEM;
+               errno = ENOMEM;
+               return -1;
        }
        if (!strcmp(nvme_ctrl_get_subsysnqn(c), NVME_DISC_SUBSYS_NAME)) {
                nvme_ctrl_set_discovery_ctrl(c, true);