From 04d9a2aab13999b6a2aba3a891407df185b6b7bc Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 28 Aug 2024 13:37:15 -0400 Subject: Add support for globals.sysconfdir --- src/stasis_indexer.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/stasis_indexer.c') diff --git a/src/stasis_indexer.c b/src/stasis_indexer.c index b0c8a26..4a9c071 100644 --- a/src/stasis_indexer.c +++ b/src/stasis_indexer.c @@ -763,6 +763,18 @@ int main(int argc, char *argv[]) { exit(1); } } + + char stasis_sysconfdir_tmp[PATH_MAX]; + if (getenv("STASIS_SYSCONFDIR")) { + strncpy(stasis_sysconfdir_tmp, getenv("STASIS_SYSCONFDIR"), sizeof(stasis_sysconfdir_tmp) - 1); + } else { + strncpy(stasis_sysconfdir_tmp, STASIS_SYSCONFDIR, sizeof(stasis_sysconfdir_tmp) - 1); + } + + globals.sysconfdir = realpath(stasis_sysconfdir_tmp, NULL); + if (!globals.sysconfdir) { + msg(STASIS_MSG_ERROR | STASIS_MSG_L1, "Unable to resolve path to configuration directory: %s\n", stasis_sysconfdir_tmp); + exit(1); } char *workdir; -- cgit