mirror of
https://github.com/troglobit/libite.git
synced 2026-11-24 20:21:38 +00:00
pidfile.c: Add LITE #ifdef pidfile and comment LITE mtime extension
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
8aecba2b7a
commit
c14c6a1e62
1 file changed
+7
-1
@@ -37,7 +37,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
static char *pidfile_path;
|
#ifndef pidfile
|
||||||
|
static char *pidfile_path = NULL;
|
||||||
static pid_t pidfile_pid;
|
static pid_t pidfile_pid;
|
||||||
|
|
||||||
static void pidfile_cleanup(void);
|
static void pidfile_cleanup(void);
|
||||||
@@ -83,6 +84,10 @@ pidfile(const char *basename)
|
|||||||
}
|
}
|
||||||
(void) fclose(f);
|
(void) fclose(f);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* LITE extension, no need to set up another atexit() handler
|
||||||
|
* if user only called us to update the mtime of the PID file
|
||||||
|
*/
|
||||||
if (pidfile_pid == pid)
|
if (pidfile_pid == pid)
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
@@ -107,3 +112,4 @@ pidfile_cleanup(void)
|
|||||||
if (pidfile_path != NULL && pidfile_pid == getpid())
|
if (pidfile_path != NULL && pidfile_pid == getpid())
|
||||||
(void) unlink(pidfile_path);
|
(void) unlink(pidfile_path);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
Reference in new issue
Block a user