From 8a4b3216f94d0f18d37f0c4408edb1a141a643a2 Mon Sep 17 00:00:00 2001 From: Valentine Krasnobaeva Date: Mon, 28 Apr 2025 23:00:17 +0200 Subject: [PATCH] MINOR: cfgparse-global: add explicit error messages in cfg_parse_global_env_opts When env variable name or value are not provided for setenv/presetenv it's not clear from the old error message shown at stderr, what exactly is missed. User needs to search in it's configuration. Let's add more explicit error messages about these inconsistencies. No need to be backported. --- src/cfgparse-global.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/cfgparse-global.c b/src/cfgparse-global.c index 370da3e94..2221ea2b9 100644 --- a/src/cfgparse-global.c +++ b/src/cfgparse-global.c @@ -1472,10 +1472,15 @@ static int cfg_parse_global_env_opts(char **args, int section_type, if (strcmp(args[0], "setenv") == 0 || strcmp(args[0], "presetenv") == 0) { if (too_many_args(2, args, err, NULL)) return -1; + if (*(args[1]) == 0) { + memprintf(err, "'%s' expects environment variable name.\n.", + args[0]); + return -1; + } if (*(args[2]) == 0) { - memprintf(err, "'%s' expects an env variable name and a value.\n.", - args[0]); + memprintf(err, "'%s' expects environment variable value for '%s'.\n.", + args[0], args[1]); return -1; }