mirror of
https://github.com/troglobit/libite.git
synced 2026-10-02 05:42:49 +07:00
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 <troglobit@gmail.com>
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user