summaryrefslogtreecommitdiffstats
path: root/src/libserver
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-03-27 14:28:32 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-03-27 14:28:32 +0100
commitfa5191e3e588fffdddd62cc3814e1fbc49bc4730 (patch)
treeb9860a4dbb297a02233d67009ff3a002576638b6 /src/libserver
parentf03c7fe732ba335f84514bccac42d649f5c998ca (diff)
downloadrspamd-fa5191e3e588fffdddd62cc3814e1fbc49bc4730.tar.gz
rspamd-fa5191e3e588fffdddd62cc3814e1fbc49bc4730.zip
[Fix] Do not create pid file in no-fork mode
Issue: #2118 Closes: #2118
Diffstat (limited to 'src/libserver')
-rw-r--r--src/libserver/worker_util.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/libserver/worker_util.c b/src/libserver/worker_util.c
index 8b4ca4027..d2cca5b68 100644
--- a/src/libserver/worker_util.c
+++ b/src/libserver/worker_util.c
@@ -629,7 +629,11 @@ rspamd_fork_worker (struct rspamd_main *rspamd_main,
setrlimit (RLIMIT_STACK, &rlim);
setproctitle ("%s process", cf->worker->name);
- rspamd_pidfile_close (rspamd_main->pfh);
+
+ if (rspamd_main->pfh) {
+ rspamd_pidfile_close (rspamd_main->pfh);
+ }
+
/* Do silent log reopen to avoid collisions */
rspamd_log_close (rspamd_main->logger);
rspamd_log_open (rspamd_main->logger);
@@ -658,7 +662,11 @@ rspamd_fork_worker (struct rspamd_main *rspamd_main,
break;
case -1:
msg_err_main ("cannot fork main process. %s", strerror (errno));
- rspamd_pidfile_remove (rspamd_main->pfh);
+
+ if (rspamd_main->pfh) {
+ rspamd_pidfile_remove (rspamd_main->pfh);
+ }
+
rspamd_hard_terminate (rspamd_main);
break;
default: