From b6319a7970acdc19c29f7016cdb65539de868e5d Mon Sep 17 00:00:00 2001 From: Daniel Wagner Date: Wed, 14 Jun 2023 14:03:53 +0200 Subject: [PATCH] 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 --- fabrics.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) 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: -- 2.49.0