1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-11 16:58:40 +03:00

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 <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
This commit is contained in:
Martin Schwenke 2024-08-09 10:53:46 +10:00 committed by Anoop C S
parent b6151faf45
commit d268c605c1

View File

@ -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);
}