From: Daniel Wagner Date: Wed, 14 Jun 2023 12:03:53 +0000 (+0200) Subject: fabrics: Do not print device on connect per default X-Git-Tag: v2.5~25 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=b6319a7970acdc19c29f7016cdb65539de868e5d;p=users%2Fsagi%2Fnvme-cli.git fabrics: Do not print device on connect per default 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 --- diff --git a/fabrics.c b/fabrics.c index 22f4da40..821d0f55 100644 --- a/fabrics.c +++ b/fabrics.c @@ -856,8 +856,8 @@ int nvmf_connect(const char *desc, int argc, char **argv) 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, @@ -873,14 +873,7 @@ int nvmf_connect(const char *desc, int argc, char **argv) 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, @@ -969,7 +962,8 @@ int nvmf_connect(const char *desc, int argc, char **argv) nvme_strerror(errno)); else { errno = 0; - nvme_show_connect_msg(c, flags); + if (flags != -EINVAL) + nvme_show_connect_msg(c, flags); } out_free: