Do not exit if problem with PID file

This commit is contained in:
ritt 2020-02-17 12:12:02 +01:00
parent 6ae0c8a974
commit 4936b76915

View File

@ -29721,7 +29721,6 @@ void server_loop(void) {
if (stat(pidfile, &finfo) >= 0) { if (stat(pidfile, &finfo) >= 0) {
/* never overwrite a file */ /* never overwrite a file */
eprintf("Refuse to overwrite existing file \"%s\".\n", pidfile); 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) { if (fd < 0) {
sprintf(str, "Error creating pid file \"%s\"", pidfile); sprintf(str, "Error creating pid file \"%s\"", pidfile);
eprintf("%s; %s\n", str, strerror(errno)); eprintf("%s; %s\n", str, strerror(errno));
exit(EXIT_FAILURE);
} }
sprintf(buf, "%d\n", (int) getpid()); sprintf(buf, "%d\n", (int) getpid());
if (write(fd, buf, strlen(buf)) == -1) { if (write(fd, buf, strlen(buf)) == -1) {
sprintf(str, "Error writing to pid file \"%s\"", pidfile); sprintf(str, "Error writing to pid file \"%s\"", pidfile);
eprintf("%s; %s\n", str, strerror(errno)); eprintf("%s; %s\n", str, strerror(errno));
exit(EXIT_FAILURE);
} }
close(fd); close(fd);
} }