You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by rp...@apache.org on 2009/02/27 16:54:37 UTC

svn commit: r748565 - /apr/apr/trunk/file_io/unix/filedup.c

Author: rpluem
Date: Fri Feb 27 15:54:37 2009
New Revision: 748565

URL: http://svn.apache.org/viewvc?rev=748565&view=rev
Log:
* One missing unroll of APR_SET_FD_CLOEXEC.

Modified:
    apr/apr/trunk/file_io/unix/filedup.c

Modified: apr/apr/trunk/file_io/unix/filedup.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/unix/filedup.c?rev=748565&r1=748564&r2=748565&view=diff
==============================================================================
--- apr/apr/trunk/file_io/unix/filedup.c (original)
+++ apr/apr/trunk/file_io/unix/filedup.c Fri Feb 27 15:54:37 2009
@@ -28,7 +28,7 @@
 #ifdef HAVE_DUP3
     int flags = 0;
 #endif
-    
+
     if (which_dup == 2) {
         if ((*new_file) == NULL) {
             /* We can't dup2 unless we have a valid new_file */
@@ -41,9 +41,18 @@
 #else
         rv = dup2(old_file->filedes, (*new_file)->filedes);
         if (!(old_file->flags & APR_INHERIT)) {
+            int flags;
+
             if (rv == -1)
                 return errno;
-            APR_SET_FD_CLOEXEC((*new_file)->filedes);
+
+            if ((flags = fcntl((*new_file)->filedes, F_GETFD)) == -1)
+                return errno;
+
+            flags |= FD_CLOEXEC;
+            if (fcntl((*new_file)->filedes, F_SETFD, flags) == -1)
+                return errno;
+
         }
 #endif
     } else {



Re: svn commit: r748565 - /apr/apr/trunk/file_io/unix/filedup.c

Posted by Bojan Smojver <bo...@rexursive.com>.
On Fri, 2009-02-27 at 15:54 +0000, rpluem@apache.org wrote:
> Author: rpluem
> Date: Fri Feb 27 15:54:37 2009
> New Revision: 748565
> 
> URL: http://svn.apache.org/viewvc?rev=748565&view=rev
> Log:
> * One missing unroll of APR_SET_FD_CLOEXEC.

Thanks. I must have been on drugs :-(

-- 
Bojan