Skip to content

Commit

Permalink
Merge pull request #449 from tbzatek/errno-fixes-2
Browse files Browse the repository at this point in the history
fabrics: Fix build_options() return values
  • Loading branch information
igaw authored Aug 1, 2022
2 parents c6d3415 + 1e472ed commit 3627e71
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/nvme/fabrics.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 3627e71

Please sign in to comment.