diff options
author | trawick <trawick@13f79535-47bb-0310-9956-ffa450edef68> | 2003-06-02 12:46:03 +0000 |
---|---|---|
committer | trawick <trawick@13f79535-47bb-0310-9956-ffa450edef68> | 2003-06-02 12:46:03 +0000 |
commit | 2e25b329b262a3be3a170f0b949c41a1b991997a (patch) | |
tree | c8f031860da69e4661c480da10ea67dcfcabfc72 /threadproc | |
parent | 480125c6081b6d7a40afe1bcc9483520c87b94d8 (diff) | |
download | libapr-2e25b329b262a3be3a170f0b949c41a1b991997a.tar.gz |
For apr_proc_detach(APR_PROC_DETACH_FOREGROUND), don't treat
a setsid() failure as fatal, as the usual cause is that the
caller is already a process group leader.
PR: 18519
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@64524 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'threadproc')
-rw-r--r-- | threadproc/unix/procsup.c | 6 |
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) |