summaryrefslogtreecommitdiff
path: root/threadproc
diff options
context:
space:
mode:
Diffstat (limited to 'threadproc')
-rw-r--r--threadproc/unix/procsup.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/threadproc/unix/procsup.c b/threadproc/unix/procsup.c
index a1d2a1c4c..25dbde658 100644
--- a/threadproc/unix/procsup.c
+++ b/threadproc/unix/procsup.c
@@ -76,7 +76,11 @@ APR_DECLARE(apr_status_t) apr_proc_detach(int daemonize)
#endif
#ifdef HAVE_SETSID
- if (setsid() == -1) {
+ /* A setsid() failure is not fatal if we didn't just fork().
+ * The calling process may be the process group leader, in
+ * which case setsid() will fail with EPERM.
+ */
+ if (setsid() == -1 && daemonize) {
return errno;
}
#elif defined(NEXT) || defined(NEWSOS)