apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s.@apache.org
Subject svn commit: r1183713 - in /apr/apr/branches/1.5.x: ./ file_io/os2/dir_make_recurse.c file_io/unix/dir.c file_io/win32/dir.c
Date Sat, 15 Oct 2011 21:08:55 GMT
Author: sf
Date: Sat Oct 15 21:08:55 2011
New Revision: 1183713

URL: http://svn.apache.org/viewvc?rev=1183713&view=rev
Log:
Backport r1183688:

    Fix race condition that could lead to EEXIST being returned

    PR: 51254
    Submitted by: William Lee <william lee rainstor com>,
                  Wim Lewis <wiml omnigroup com>


Modified:
    apr/apr/branches/1.5.x/   (props changed)
    apr/apr/branches/1.5.x/file_io/os2/dir_make_recurse.c
    apr/apr/branches/1.5.x/file_io/unix/dir.c
    apr/apr/branches/1.5.x/file_io/win32/dir.c

Propchange: apr/apr/branches/1.5.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Oct 15 21:08:55 2011
@@ -1,2 +1,2 @@
 /apr/apr/branches/1.4.x:1101301
-/apr/apr/trunk:733052,747990,748361,748371,748565,748888,748902,748988,749810,760443,782838,783398,783958,784633,784773,788588,793192-793193,794118,794485,795267,799497,800627,809745,809854,810472,811455,813063,821306,829490,831641,835607,908427,910419,917819,917837-917838,983618,990435,1055657,1072165,1078845,1183683,1183685-1183686
+/apr/apr/trunk:733052,747990,748361,748371,748565,748888,748902,748988,749810,760443,782838,783398,783958,784633,784773,788588,793192-793193,794118,794485,795267,799497,800627,809745,809854,810472,811455,813063,821306,829490,831641,835607,908427,910419,917819,917837-917838,983618,990435,1055657,1072165,1078845,1183683,1183685-1183686,1183688

Modified: apr/apr/branches/1.5.x/file_io/os2/dir_make_recurse.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/file_io/os2/dir_make_recurse.c?rev=1183713&r1=1183712&r2=1183713&view=diff
==============================================================================
--- apr/apr/branches/1.5.x/file_io/os2/dir_make_recurse.c (original)
+++ apr/apr/branches/1.5.x/file_io/os2/dir_make_recurse.c Sat Oct 15 21:08:55 2011
@@ -67,10 +67,6 @@ apr_status_t apr_dir_make_recursive(cons
     
     apr_err = apr_dir_make(path, perm, pool); /* Try to make PATH right out */
 
-    if (APR_STATUS_IS_EEXIST(apr_err)) { /* It's OK if PATH exists */
-        return APR_SUCCESS;
-    }
-
     if (APR_STATUS_IS_ENOENT(apr_err)) { /* Missing an intermediate dir */
         char *dir;
 
@@ -82,5 +78,13 @@ apr_status_t apr_dir_make_recursive(cons
         }
     }
 
+    /*
+     * It's OK if PATH exists. Timing issues can lead to the second
+     * apr_dir_make being called on existing dir, therefore this check
+     * has to come last.
+     */
+    if (APR_STATUS_IS_EEXIST(apr_err))
+        return APR_SUCCESS;
+
     return apr_err;
 }

Modified: apr/apr/branches/1.5.x/file_io/unix/dir.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/file_io/unix/dir.c?rev=1183713&r1=1183712&r2=1183713&view=diff
==============================================================================
--- apr/apr/branches/1.5.x/file_io/unix/dir.c (original)
+++ apr/apr/branches/1.5.x/file_io/unix/dir.c Sat Oct 15 21:08:55 2011
@@ -305,9 +305,6 @@ apr_status_t apr_dir_make_recursive(cons
     
     apr_err = apr_dir_make (path, perm, pool); /* Try to make PATH right out */
     
-    if (apr_err == EEXIST) /* It's OK if PATH exists */
-        return APR_SUCCESS;
-    
     if (apr_err == ENOENT) { /* Missing an intermediate dir */
         char *dir;
         
@@ -323,6 +320,14 @@ apr_status_t apr_dir_make_recursive(cons
             apr_err = apr_dir_make (path, perm, pool);
     }
 
+    /*
+     * It's OK if PATH exists. Timing issues can lead to the second
+     * apr_dir_make being called on existing dir, therefore this check
+     * has to come last.
+     */
+    if (APR_STATUS_IS_EEXIST(apr_err))
+        return APR_SUCCESS;
+
     return apr_err;
 }
 

Modified: apr/apr/branches/1.5.x/file_io/win32/dir.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/file_io/win32/dir.c?rev=1183713&r1=1183712&r2=1183713&view=diff
==============================================================================
--- apr/apr/branches/1.5.x/file_io/win32/dir.c (original)
+++ apr/apr/branches/1.5.x/file_io/win32/dir.c Sat Oct 15 21:08:55 2011
@@ -333,9 +333,6 @@ APR_DECLARE(apr_status_t) apr_dir_make_r
     
     rv = apr_dir_make (path, perm, pool); /* Try to make PATH right out */
     
-    if (APR_STATUS_IS_EEXIST(rv)) /* It's OK if PATH exists */
-        return APR_SUCCESS;
-    
     if (APR_STATUS_IS_ENOENT(rv)) { /* Missing an intermediate dir */
         char *dir;
         
@@ -347,6 +344,15 @@ APR_DECLARE(apr_status_t) apr_dir_make_r
         if (rv == APR_SUCCESS)
             rv = apr_dir_make (dir, perm, pool);   /* And complete the path */
     }
+
+    /*
+     * It's OK if PATH exists. Timing issues can lead to the second
+     * apr_dir_make being called on existing dir, therefore this check
+     * has to come last.
+     */
+    if (APR_STATUS_IS_EEXIST(apr_err))
+        return APR_SUCCESS;
+
     return rv;
 }
 



Mime
View raw message