Some platforms doesn't have a /tmp/ directory where temporary files can be

stored. Make it possible to override that location compile time.
This commit is contained in:
Daniel Fahlgren 2022-08-17 13:16:25 +02:00 committed by Joris Vink
parent 5ddfc2131c
commit 2211bb8f97
2 changed files with 4 additions and 2 deletions

View File

@ -13,6 +13,7 @@ MAN_DIR?=$(PREFIX)/share/man
SHARE_DIR=$(PREFIX)/share/kore
INCLUDE_DIR=$(PREFIX)/include/kore
TLS_BACKEND?=openssl
KORE_TMPDIR?=/tmp
TOOLS= kore-serve
@ -56,7 +57,7 @@ endif
endif
ifneq ("$(KORE_SINGLE_BINARY)", "")
CFLAGS+=-DKORE_SINGLE_BINARY
CFLAGS+=-DKORE_SINGLE_BINARY -DKORE_TMPDIR='"$(KORE_TMPDIR)"'
FEATURES+=-DKORE_SINGLE_BINARY
endif

View File

@ -761,7 +761,8 @@ config_file_write(void)
int fd, len;
char fpath[MAXPATHLEN];
len = snprintf(fpath, sizeof(fpath), "/tmp/%s.XXXXXX", __progname);
len = snprintf(fpath, sizeof(fpath), "%s/%s.XXXXXX", KORE_TMPDIR,
__progname);
if (len == -1 || (size_t)len >= sizeof(fpath))
fatal("failed to create temporary path");