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.
This commit is contained in:
Willy Tarreau 2021-05-06 14:50:30 +02:00
parent 7541056aa0
commit 3e293a9135

View File

@ -359,7 +359,12 @@ int make_arg_list(const char *in, int len, uint64_t mask, struct arg **argp,
} else { } else {
/* the caller is responsible for freeing this message */ /* the caller is responsible for freeing this message */
char *word = (len > 0) ? my_strndup(in, len) : (char *)in; char *word = (len > 0) ? my_strndup(in, len) : (char *)in;
if (*word)
memprintf(err_msg, "expected ')' before '%s'", word); memprintf(err_msg, "expected ')' before '%s'", word);
else
memprintf(err_msg, "expected ')'");
if (len > 0) if (len > 0)
free(word); free(word);
/* when we're missing a right paren, the empty part preceding /* when we're missing a right paren, the empty part preceding