From: William Lallemand Date: Tue, 28 Nov 2023 16:28:07 +0000 (+0100) Subject: CLEANUP: mworker/cli: use a label to return errors X-Git-Tag: v2.9-dev12~45 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dd38c3777798917d5d1b04723382bae18c71cc01;p=thirdparty%2Fhaproxy.git CLEANUP: mworker/cli: use a label to return errors Remove the returns in the function to end directly at the end label. --- diff --git a/src/cli.c b/src/cli.c index 24184287a7..94f2297451 100644 --- a/src/cli.c +++ b/src/cli.c @@ -2605,13 +2605,15 @@ int pcli_parse_request(struct stream *s, struct channel *req, char **errmsg, int /* there is no end to this command, need more to parse ! */ if (!reql || *(end-1) != '\n') { - return -1; + ret = -1; + goto end; } if (s->pcli_flags & PCLI_F_PAYLOAD) { if (reql == 1) /* last line of the payload */ s->pcli_flags &= ~PCLI_F_PAYLOAD; - return reql; + ret = reql; + goto end; } *(end-1) = '\0'; @@ -2674,7 +2676,8 @@ int pcli_parse_request(struct stream *s, struct channel *req, char **errmsg, int ret = end - trim; } else if (wtrim < 0) { /* parsing error */ - return -1; + ret = -1; + goto end; } else { /* the whole string */ ret = end - str;