trawick 2003/06/02 05:46:04
Modified: . CHANGES
threadproc/unix procsup.c
Log:
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
Revision Changes Path
1.413 +5 -0 apr/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/apr/CHANGES,v
retrieving revision 1.412
retrieving revision 1.413
diff -u -r1.412 -r1.413
--- CHANGES 30 May 2003 12:50:39 -0000 1.412
+++ CHANGES 2 Jun 2003 12:46:03 -0000 1.413
@@ -1,5 +1,10 @@
Changes with APR 0.9.4
+ *) 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
+ [Jeff Trawick]
+
*) Fix some problems with non-blocking socket handling on unix
that resulted in infinite timeouts being used for non-blocking
sockets with apr_socket_connect() and some read/write calls.
1.39 +5 -1 apr/threadproc/unix/procsup.c
Index: procsup.c
===================================================================
RCS file: /home/cvs/apr/threadproc/unix/procsup.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- procsup.c 6 Jan 2003 23:44:38 -0000 1.38
+++ procsup.c 2 Jun 2003 12:46:03 -0000 1.39
@@ -76,7 +76,11 @@
#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)