From c009c49a929c9f33957b2ff89a9535d23eb2ccc4 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Mon, 6 Jun 2016 12:14:26 +0200 Subject: [PATCH] Expose __pidfile_path to override _PATH_VARRUN This patch makes it possible to override the default pidfile() path used for PID files, _PATH_VARRUN, with a custom path, e.g. _PATH_TMP. This change does not affect the ABI of pidfile() Signed-off-by: Joachim Nilsson --- pidfile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pidfile.c b/pidfile.c index 6420eeb..2a97fad 100644 --- a/pidfile.c +++ b/pidfile.c @@ -45,6 +45,7 @@ static pid_t pidfile_pid; static void pidfile_cleanup(void); +const char *__pidfile_path = _PATH_VARRUN; /* Note: includes trailing slash '/' */ const char *__pidfile_name = NULL; extern char *__progname; @@ -73,8 +74,7 @@ pidfile(const char *basename) atexit_already = 1; } - /* _PATH_VARRUN includes trailing / */ - if (asprintf(&pidfile_path, "%s%s.pid", _PATH_VARRUN, basename) == -1) + if (asprintf(&pidfile_path, "%s%s.pid", __pidfile_path, basename) == -1) return (-1); if ((f = fopen(pidfile_path, "w")) == NULL) {