pidfile: Re-create file on consequetive calls if it doesn't exist

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2017-01-07 08:15:49 +01:00
parent 59f7a78441
commit 66290d132f
+2 -2
View File
@@ -65,7 +65,7 @@ pidfile(const char *basename)
atexit_already = 0;
if (pidfile_path != NULL) {
if (pid == pidfile_pid) {
if (!access(pidfile_path, R_OK) && pid == pidfile_pid) {
utimensat(0, pidfile_path, NULL, 0);
return (0);
}
@@ -96,6 +96,7 @@ pidfile(const char *basename)
return (-1);
}
(void) fclose(f);
__pidfile_name = pidfile_path;
/*
* LITE extension, no need to set up another atexit() handler
@@ -114,7 +115,6 @@ pidfile(const char *basename)
errno = save_errno;
return (-1);
}
__pidfile_name = pidfile_path;
return (0);
}