From 3e293a91357acf86ca52da7ea54ba1f96bf5c2c3 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 6 May 2021 14:50:30 +0200 Subject: [PATCH] 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. --- src/arg.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 -- 2.47.3