You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by sf...@apache.org on 2011/10/15 23:10:19 UTC
svn commit: r1183715 - in /apr/apr/branches/1.4.x: ./ CHANGES
file_io/os2/dir_make_recurse.c file_io/unix/dir.c file_io/win32/dir.c
Author: sf
Date: Sat Oct 15 21:10:18 2011
New Revision: 1183715
URL: http://svn.apache.org/viewvc?rev=1183715&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.4.x/ (props changed)
apr/apr/branches/1.4.x/CHANGES
apr/apr/branches/1.4.x/file_io/os2/dir_make_recurse.c
apr/apr/branches/1.4.x/file_io/unix/dir.c
apr/apr/branches/1.4.x/file_io/win32/dir.c
Propchange: apr/apr/branches/1.4.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Oct 15 21:10:18 2011
@@ -1,2 +1,2 @@
/apr/apr/branches/1.5.x:1083592
-/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,905040,908427,910419,917837-917838,983618,990435,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,905040,908427,910419,917837-917838,983618,990435,1072165,1078845,1183683,1183685-1183686,1183688
Modified: apr/apr/branches/1.4.x/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/CHANGES?rev=1183715&r1=1183714&r2=1183715&view=diff
==============================================================================
--- apr/apr/branches/1.4.x/CHANGES [utf-8] (original)
+++ apr/apr/branches/1.4.x/CHANGES [utf-8] Sat Oct 15 21:10:18 2011
@@ -1,6 +1,10 @@
-*- coding: utf-8 -*-
Changes for APR 1.4.6
+ *) apr_dir_make_recursive: Fix race condition that could lead to EEXIST
+ being returned. PR 51254. [William Lee <william lee rainstor com>,
+ Wim Lewis <wiml omnigroup com>]
+
*) configure: Fix APR_RESTORE_THE_ENVIRONMENT if the original variable was
a single space. PR 50334. [Nathan Phillip Brink <binki gentoo org>]
Modified: apr/apr/branches/1.4.x/file_io/os2/dir_make_recurse.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/file_io/os2/dir_make_recurse.c?rev=1183715&r1=1183714&r2=1183715&view=diff
==============================================================================
--- apr/apr/branches/1.4.x/file_io/os2/dir_make_recurse.c (original)
+++ apr/apr/branches/1.4.x/file_io/os2/dir_make_recurse.c Sat Oct 15 21:10:18 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.4.x/file_io/unix/dir.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/file_io/unix/dir.c?rev=1183715&r1=1183714&r2=1183715&view=diff
==============================================================================
--- apr/apr/branches/1.4.x/file_io/unix/dir.c (original)
+++ apr/apr/branches/1.4.x/file_io/unix/dir.c Sat Oct 15 21:10:18 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.4.x/file_io/win32/dir.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/file_io/win32/dir.c?rev=1183715&r1=1183714&r2=1183715&view=diff
==============================================================================
--- apr/apr/branches/1.4.x/file_io/win32/dir.c (original)
+++ apr/apr/branches/1.4.x/file_io/win32/dir.c Sat Oct 15 21:10:18 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;
}
Re: svn commit: r1183715 - in /apr/apr/branches/1.4.x: ./ CHANGES
file_io/os2/dir_make_recurse.c file_io/unix/dir.c file_io/win32/dir.c
Posted by "William A. Rowe Jr." <wr...@rowe-clan.net>.
On 10/15/2011 4:10 PM, sf@apache.org wrote:
> Author: sf
> Date: Sat Oct 15 21:10:18 2011
> New Revision: 1183715
>
> URL: http://svn.apache.org/viewvc?rev=1183715&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.4.x/file_io/win32/dir.c
> URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/file_io/win32/dir.c?rev=1183715&r1=1183714&r2=1183715&view=diff
> ==============================================================================
> --- apr/apr/branches/1.4.x/file_io/win32/dir.c (original)
> +++ apr/apr/branches/1.4.x/file_io/win32/dir.c Sat Oct 15 21:10:18 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;
> }
>
Stefan, what is an apr_err? Inquiring compilers want to know. Pls fix.