On Tue, 2009-03-03 at 21:51 +0100, Stefan Fritsch wrote:

> The problem with the CLOEXEC-patch is that apr_file_dup2() now only 
> checks for APR_INHERIT but not for APR_FILE_NOCLEANUP to determine if 
> FD_CLOEXEC should be set. But APR_FILE_NOCLEANUP should imply 
> APR_INHERIT and the new apr_file_dup2 needs to be changed.

Did you mean like this?

-- 
Bojan
Index: file_io/unix/filedup.c
===================================================================
--- file_io/unix/filedup.c	(revision 749759)
+++ file_io/unix/filedup.c	(working copy)
@@ -35,12 +35,12 @@
             return APR_EINVAL;
         }
 #ifdef HAVE_DUP3
-        if (!(old_file->flags & APR_INHERIT))
+        if (!(flag & APR_FILE_NOCLEANUP) && !(old_file->flags & APR_INHERIT))
             flags |= O_CLOEXEC;
         rv = dup3(old_file->filedes, (*new_file)->filedes, flags);
 #else
         rv = dup2(old_file->filedes, (*new_file)->filedes);
-        if (!(old_file->flags & APR_INHERIT)) {
+        if (!(flag & APR_FILE_NOCLEANUP) && !(old_file->flags & APR_INHERIT)) {
             int flags;
 
             if (rv == -1)

Reply via email to