diff options
author | Jeff Trawick <trawick@apache.org> | 2003-06-02 12:46:03 +0000 |
---|---|---|
committer | Jeff Trawick <trawick@apache.org> | 2003-06-02 12:46:03 +0000 |
commit | dc8fc57020c2dbdc7969316530f07ba2a1106e42 (patch) | |
tree | c8f031860da69e4661c480da10ea67dcfcabfc72 /threadproc/unix | |
parent | ef773556aca88517a6550c86aff3dbcefadecd31 (diff) | |
download | apr-dc8fc57020c2dbdc7969316530f07ba2a1106e42.tar.gz apr-dc8fc57020c2dbdc7969316530f07ba2a1106e42.zip |
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: https://svn.apache.org/repos/asf/apr/apr/trunk@64524 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'threadproc/unix')
-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) |