During the print code refactoring, the show connect message was enabled
per default. To avoid any regressions in application restore the old
behavior and print only the result when the '-o' option is used.
Fixes: 0576d84bf4aa ("fabrics: Move printing functions to the print files")
Signed-off-by: Daniel Wagner <dwagner@suse.de>
nvme_host_t h;
nvme_ctrl_t c;
int ret;
- struct nvme_fabrics_config cfg;
- enum nvme_print_flags flags = -1;
+ enum nvme_print_flags flags;
+ struct nvme_fabrics_config cfg = { 0 };
char *format = "";
NVMF_ARGS(opts, cfg,
if (ret)
return ret;
- if (!strcmp(format, ""))
- flags = -1;
- else if (!strcmp(format, "normal"))
- flags = NORMAL;
- else if (!strcmp(format, "json"))
- flags = JSON;
- else
- return -EINVAL;
+ flags = validate_output_format(format);
if (!subsysnqn) {
fprintf(stderr,
nvme_strerror(errno));
else {
errno = 0;
- nvme_show_connect_msg(c, flags);
+ if (flags != -EINVAL)
+ nvme_show_connect_msg(c, flags);
}
out_free: