diff --git a/addons/ot/src/cli.c b/addons/ot/src/cli.c index 9132fe907..0080dbd43 100644 --- a/addons/ot/src/cli.c +++ b/addons/ot/src/cli.c @@ -97,7 +97,7 @@ static int flt_ot_cli_parse_debug(char **args, char *payload, struct appctx *app (void)memprintf(&msg, FLT_OT_CLI_CMD " : current debug level is %hhu", value); } - cmn_cli_set_msg(appctx, err, msg, CLI_ST_PRINT_FREE); + cmn_cli_set_msg(appctx, err, msg, CLI_ST_PRINT_DYNERR); FLT_OT_RETURN_INT(retval); } @@ -137,7 +137,7 @@ static int flt_ot_cli_parse_disabled(char **args, char *payload, struct appctx * (void)memprintf(&msg, "%s%s" FLT_OT_CLI_CMD " : filter %sabled", FLT_OT_CLI_MSG_CAT(msg), value ? "dis" : "en"); } FLT_OT_PROXIES_LIST_END(); - cmn_cli_set_msg(appctx, NULL, msg, CLI_ST_PRINT_FREE); + cmn_cli_set_msg(appctx, NULL, msg, CLI_ST_PRINT_DYNERR); FLT_OT_RETURN_INT(retval); } @@ -175,7 +175,7 @@ static int flt_ot_cli_parse_option(char **args, char *payload, struct appctx *ap (void)memprintf(&msg, "%s%s" FLT_OT_CLI_CMD " : filter set %s-errors", FLT_OT_CLI_MSG_CAT(msg), value ? "hard" : "soft"); } FLT_OT_PROXIES_LIST_END(); - cmn_cli_set_msg(appctx, NULL, msg, CLI_ST_PRINT_FREE); + cmn_cli_set_msg(appctx, NULL, msg, CLI_ST_PRINT_DYNERR); FLT_OT_RETURN_INT(retval); } @@ -238,7 +238,7 @@ static int flt_ot_cli_parse_logging(char **args, char *payload, struct appctx *a } FLT_OT_PROXIES_LIST_END(); } - cmn_cli_set_msg(appctx, err, msg, CLI_ST_PRINT_FREE); + cmn_cli_set_msg(appctx, err, msg, CLI_ST_PRINT_DYNERR); FLT_OT_RETURN_INT(retval); } @@ -289,7 +289,7 @@ static int flt_ot_cli_parse_rate(char **args, char *payload, struct appctx *appc } FLT_OT_PROXIES_LIST_END(); } - cmn_cli_set_msg(appctx, err, msg, CLI_ST_PRINT_FREE); + cmn_cli_set_msg(appctx, err, msg, CLI_ST_PRINT_DYNERR); FLT_OT_RETURN_INT(retval); } @@ -343,7 +343,7 @@ static int flt_ot_cli_parse_status(char **args, char *payload, struct appctx *ap nl = "\n"; } FLT_OT_PROXIES_LIST_END(); - cmn_cli_set_msg(appctx, NULL, msg, CLI_ST_PRINT_FREE); + cmn_cli_set_msg(appctx, NULL, msg, CLI_ST_PRINT_DYNERR); FLT_OT_RETURN_INT(retval); } diff --git a/include/haproxy/cli-t.h b/include/haproxy/cli-t.h index 3a61656ce..7570954b2 100644 --- a/include/haproxy/cli-t.h +++ b/include/haproxy/cli-t.h @@ -57,7 +57,7 @@ enum { CLI_ST_PRINT, /* display const message in cli->msg */ CLI_ST_PRINT_ERR, /* display const error in cli->msg */ CLI_ST_PRINT_DYN, /* display dynamic message in cli->err. After the display, free the pointer */ - CLI_ST_PRINT_FREE, /* display dynamic error in cli->err. After the display, free the pointer */ + CLI_ST_PRINT_DYNERR, /* display dynamic error in cli->err. After the display, free the pointer */ CLI_ST_CALLBACK, /* custom callback pointer */ }; @@ -72,7 +72,7 @@ enum { /* CLI context for printing command responses. */ struct cli_print_ctx { const char *msg; /* pointer to a persistent message to be returned in CLI_ST_PRINT state */ - char *err; /* pointer to a 'must free' message to be returned in CLI_ST_PRINT_FREE state */ + char *err; /* pointer to a 'must free' message to be returned in CLI_ST_PRINT_DYN state */ int severity; /* severity of the message to be returned according to (syslog) rfc5424 */ }; diff --git a/include/haproxy/cli.h b/include/haproxy/cli.h index 379bc3863..bb5c23c98 100644 --- a/include/haproxy/cli.h +++ b/include/haproxy/cli.h @@ -104,7 +104,7 @@ static inline int cli_dynerr(struct appctx *appctx, char *err) struct cli_print_ctx *ctx = applet_reserve_svcctx(appctx, sizeof(*ctx)); ctx->err = err; - appctx->st0 = CLI_ST_PRINT_FREE; + appctx->st0 = CLI_ST_PRINT_DYNERR; return 1; } diff --git a/src/cli.c b/src/cli.c index 5635ea826..406b850ce 100644 --- a/src/cli.c +++ b/src/cli.c @@ -1041,7 +1041,7 @@ static void cli_io_handler(struct appctx *appctx) case CLI_ST_PRINT: /* print const message in msg */ case CLI_ST_PRINT_ERR: /* print const error in msg */ case CLI_ST_PRINT_DYN: /* print dyn message in msg, free */ - case CLI_ST_PRINT_FREE: /* print dyn error in err, free */ + case CLI_ST_PRINT_DYNERR: /* print dyn error in err, free */ /* the message is in the svcctx */ ctx = applet_reserve_svcctx(appctx, sizeof(*ctx)); if (appctx->st0 == CLI_ST_PRINT || appctx->st0 == CLI_ST_PRINT_ERR) { @@ -1049,8 +1049,8 @@ static void cli_io_handler(struct appctx *appctx) LOG_ERR : ctx->severity; msg = ctx->msg; } - else if (appctx->st0 == CLI_ST_PRINT_DYN || appctx->st0 == CLI_ST_PRINT_FREE) { - sev = appctx->st0 == CLI_ST_PRINT_FREE ? + else if (appctx->st0 == CLI_ST_PRINT_DYN || appctx->st0 == CLI_ST_PRINT_DYNERR) { + sev = appctx->st0 == CLI_ST_PRINT_DYNERR ? LOG_ERR : ctx->severity; msg = ctx->err; if (!msg) { @@ -1064,8 +1064,8 @@ static void cli_io_handler(struct appctx *appctx) } if (cli_output_msg(res, msg, sev, cli_get_severity_output(appctx)) != -1) { - if (appctx->st0 == CLI_ST_PRINT_FREE || - appctx->st0 == CLI_ST_PRINT_DYN) { + if (appctx->st0 == CLI_ST_PRINT_DYN || + appctx->st0 == CLI_ST_PRINT_DYNERR) { ha_free(&ctx->err); } appctx->st0 = CLI_ST_PROMPT; @@ -1193,7 +1193,7 @@ static void cli_release_handler(struct appctx *appctx) appctx->io_release(appctx); appctx->io_release = NULL; } - else if (appctx->st0 == CLI_ST_PRINT_FREE || appctx->st0 == CLI_ST_PRINT_DYN) { + else if (appctx->st0 == CLI_ST_PRINT_DYN || appctx->st0 == CLI_ST_PRINT_DYNERR) { struct cli_print_ctx *ctx = applet_reserve_svcctx(appctx, sizeof(*ctx)); ha_free(&ctx->err);