From: Willy Tarreau Date: Thu, 6 May 2021 12:50:30 +0000 (+0200) Subject: MINOR: arg: improve the error message on missing closing parenthesis X-Git-Tag: v2.4-dev19~115 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3e293a91357acf86ca52da7ea54ba1f96bf5c2c3;p=thirdparty%2Fhaproxy.git MINOR: arg: improve the error message on missing closing parenthesis When the closing brace is missing after an argument (acl, ...), the error may report something like "expected ')' before ''". Let's just drop "before ''" when the final word is empty to make the message a bit clearer. --- diff --git a/src/arg.c b/src/arg.c index 8b3dccf31f..5d5766b745 100644 --- a/src/arg.c +++ b/src/arg.c @@ -359,7 +359,12 @@ int make_arg_list(const char *in, int len, uint64_t mask, struct arg **argp, } else { /* the caller is responsible for freeing this message */ char *word = (len > 0) ? my_strndup(in, len) : (char *)in; - memprintf(err_msg, "expected ')' before '%s'", word); + + if (*word) + memprintf(err_msg, "expected ')' before '%s'", word); + else + memprintf(err_msg, "expected ')'"); + if (len > 0) free(word); /* when we're missing a right paren, the empty part preceding