apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rpl...@apache.org
Subject svn commit: r748565 - /apr/apr/trunk/file_io/unix/filedup.c
Date Fri, 27 Feb 2009 15:54:37 GMT
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 {



Mime
View raw message