Do not exit if problem with PID file

This commit is contained in:
2020-02-17 12:12:02 +01:00
parent 6ae0c8a974
commit 4936b76915
-3
View File
@@ -29721,7 +29721,6 @@ void server_loop(void) {
if (stat(pidfile, &finfo) >= 0) {
/* never overwrite a file */
eprintf("Refuse to overwrite existing file \"%s\".\n", pidfile);
_exit(EXIT_FAILURE); /* don't call atexit() hook */
}
}
@@ -29729,14 +29728,12 @@ void server_loop(void) {
if (fd < 0) {
sprintf(str, "Error creating pid file \"%s\"", pidfile);
eprintf("%s; %s\n", str, strerror(errno));
exit(EXIT_FAILURE);
}
sprintf(buf, "%d\n", (int) getpid());
if (write(fd, buf, strlen(buf)) == -1) {
sprintf(str, "Error writing to pid file \"%s\"", pidfile);
eprintf("%s; %s\n", str, strerror(errno));
exit(EXIT_FAILURE);
}
close(fd);
}