From: Martin Schwenke Date: Fri, 9 Aug 2024 00:53:46 +0000 (+1000) Subject: ctdb-daemon: Ensure CTDB_BASE is set, don't fetch it X-Git-Tag: tdb-1.4.13~985 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d268c605c188a20dfb978e3fc9b8b6c10af35a4f;p=thirdparty%2Fsamba.git ctdb-daemon: Ensure CTDB_BASE is set, don't fetch it Uses of CTDB_BASE in the subsequent code are now handled by the path module, so there is no point getting the value of CTDB_BASE. Instead, check that the attempt to set it worked, noting that: [...] if overwrite is zero, then the value of name is not changed (and setenv() returns a success status). Signed-off-by: Martin Schwenke Reviewed-by: Anoop C S --- diff --git a/ctdb/server/ctdbd.c b/ctdb/server/ctdbd.c index 23abb393e74..0c55ef50b0e 100644 --- a/ctdb/server/ctdbd.c +++ b/ctdb/server/ctdbd.c @@ -165,7 +165,6 @@ int main(int argc, const char *argv[]) const char **extra_argv; poptContext pc; struct tevent_context *ev; - const char *ctdb_base; struct conf_context *conf; const char *logging_location; const char *test_mode; @@ -195,10 +194,9 @@ int main(int argc, const char *argv[]) } /* Default value for CTDB_BASE - don't override */ - setenv("CTDB_BASE", CTDB_ETCDIR, 0); - ctdb_base = getenv("CTDB_BASE"); - if (ctdb_base == NULL) { - D_ERR("CTDB_BASE not set\n"); + ret = setenv("CTDB_BASE", CTDB_ETCDIR, 0); + if (ret != 0) { + D_ERR("Unable to set CTDB_BASE (errno=%d)\n", errno); exit(1); }