From: Martin Schwenke Date: Sat, 11 Oct 2025 04:45:09 +0000 (+1100) Subject: ctdb-event: Improve error message X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5a30073278e038629cf80f7d4df5b11b4c0ebaeb;p=thirdparty%2Fsamba.git ctdb-event: Improve error message The current message: Command script list finished with result=2 does not clearly explain the problem. Improve it. Signed-off-by: Martin Schwenke Reviewed-by: Ralph Boehme --- diff --git a/ctdb/event/event_tool.c b/ctdb/event/event_tool.c index baf4763cb1f..b93b9454ad1 100644 --- a/ctdb/event/event_tool.c +++ b/ctdb/event/event_tool.c @@ -385,6 +385,7 @@ static int event_command_script_list(TALLOC_CTX *mem_ctx, char *data_dir = NULL; char *etc_dir = NULL; char *t = NULL; + char *real_data_dir = NULL; struct event_script_list *data_list = NULL; struct event_script_list *etc_list = NULL; unsigned int i, j, matched; @@ -410,14 +411,18 @@ static int event_command_script_list(TALLOC_CTX *mem_ctx, return ENOMEM; } - data_dir = realpath(data_dir, t); - if (data_dir == NULL) { + real_data_dir = realpath(data_dir, t); + if (real_data_dir == NULL) { if (errno != ENOENT) { return errno; } - D_ERR("Command script list finished with result=%d\n", ENOENT); + D_ERR("Unable to find event script installation directory: %s\n", + data_dir); return ENOENT; } + /* Some static analysers don't understand talloc */ + TALLOC_FREE(data_dir); + data_dir = real_data_dir; etc_dir = path_etcdir_append(mem_ctx, subdir); if (etc_dir == NULL) { diff --git a/ctdb/tests/UNIT/eventd/eventd_001.sh b/ctdb/tests/UNIT/eventd/eventd_001.sh index 7d4ee9e4e91..2d39ee5ab1b 100755 --- a/ctdb/tests/UNIT/eventd/eventd_001.sh +++ b/ctdb/tests/UNIT/eventd/eventd_001.sh @@ -21,7 +21,8 @@ Script 01.test does not exist in foobar EOF simple_test script enable foobar 01.test +dir="${CTDB_BASE}/share/events/foobar" required_error ENOENT <