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 committed 2017-01-07 08:15:49 +01:00
1 parent 59f7a78441
commit 66290d132f
1 file changed
+2 -2
+2 -2
View File
@@ -65,7 +65,7 @@ pidfile(const char *basename)
atexit_already = 0; atexit_already = 0;
if (pidfile_path != NULL) { if (pidfile_path != NULL) {
if (pid == pidfile_pid) { if (!access(pidfile_path, R_OK) && pid == pidfile_pid) {
utimensat(0, pidfile_path, NULL, 0); utimensat(0, pidfile_path, NULL, 0);
return (0); return (0);
} }
@@ -96,6 +96,7 @@ pidfile(const char *basename)
return (-1); return (-1);
} }
(void) fclose(f); (void) fclose(f);
__pidfile_name = pidfile_path;
/* /*
* LITE extension, no need to set up another atexit() handler * LITE extension, no need to set up another atexit() handler
@@ -114,7 +115,6 @@ pidfile(const char *basename)
errno = save_errno; errno = save_errno;
return (-1); return (-1);
} }
__pidfile_name = pidfile_path;
return (0); return (0);
} }