Skip to content

Commit 3627e71

Browse files
authored
Merge pull request #449 from tbzatek/errno-fixes-2
fabrics: Fix build_options() return values
2 parents c6d3415 + 1e472ed commit 3627e71

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/nvme/fabrics.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -438,20 +438,23 @@ static int build_options(nvme_host_t h, nvme_ctrl_t c, char **argstr)
438438

439439
if (!transport) {
440440
nvme_msg(h->r, LOG_ERR, "need a transport (-t) argument\n");
441-
return -ENVME_CONNECT_TARG;
441+
errno = ENVME_CONNECT_TARG;
442+
return -1;
442443
}
443444

444445
if (strncmp(transport, "loop", 4)) {
445446
if (!nvme_ctrl_get_traddr(c)) {
446447
nvme_msg(h->r, LOG_ERR, "need a address (-a) argument\n");
447-
return -ENVME_CONNECT_AARG;
448+
errno = ENVME_CONNECT_AARG;
449+
return -1;
448450
}
449451
}
450452

451453
/* always specify nqn as first arg - this will init the string */
452454
if (asprintf(argstr, "nqn=%s",
453455
nvme_ctrl_get_subsysnqn(c)) < 0) {
454-
return -ENOMEM;
456+
errno = ENOMEM;
457+
return -1;
455458
}
456459
if (!strcmp(nvme_ctrl_get_subsysnqn(c), NVME_DISC_SUBSYS_NAME)) {
457460
nvme_ctrl_set_discovery_ctrl(c, true);

0 commit comments

Comments
 (0)