Author: rhuijben
Date: Fri Aug 22 09:48:42 2014
New Revision: 1619723

URL: http://svn.apache.org/r1619723
Log:
* subversion/tests/svn_test_fs.c
  (create_fs,
   svn_test__create_repos): Simplify code (written around 2006), by relying
    on the ignore_noent handling in svn_io_remove_dir2(). This removes a
    (never seen/theoretical) race condition.

Modified:
    subversion/trunk/subversion/tests/svn_test_fs.c

Modified: subversion/trunk/subversion/tests/svn_test_fs.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/svn_test_fs.c?rev=1619723&r1=1619722&r2=1619723&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/svn_test_fs.c (original)
+++ subversion/trunk/subversion/tests/svn_test_fs.c Fri Aug 22 09:48:42 2014
@@ -114,18 +114,7 @@ create_fs(svn_fs_t **fs_p,
      failure for postmortem analysis, but also that tests can be
      re-run without cleaning out the repositories created by prior
      runs.  */
-  if (apr_stat(&finfo, name, APR_FINFO_TYPE, pool) == APR_SUCCESS)
-    {
-      if (finfo.filetype == APR_DIR)
-        SVN_ERR_W(svn_io_remove_dir2(name, TRUE, NULL, NULL, pool),
-                  apr_psprintf(pool,
-                               "cannot create fs '%s' there is already "
-                               "a directory of that name", name));
-      else
-        return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
-                                 "cannot create fs '%s' there is already "
-                                 "a file of that name", name);
-    }
+  SVN_ERR(svn_io_remove_dir2(name, TRUE, NULL, NULL, pool));
 
   SVN_ERR(svn_fs_create(fs_p, name, fs_config, pool));
   if (! *fs_p)
@@ -227,17 +216,7 @@ svn_test__create_repos(svn_repos_t **rep
      failure for postmortem analysis, but also that tests can be
      re-run without cleaning out the repositories created by prior
      runs.  */
-  if (apr_stat(&finfo, name, APR_FINFO_TYPE, pool) == APR_SUCCESS)
-    {
-      if (finfo.filetype == APR_DIR)
-        SVN_ERR_W(svn_io_remove_dir2(name, TRUE, NULL, NULL, pool),
-                  apr_psprintf(pool,
-                               "cannot create repos '%s' there is already "
-                               "a directory of that name", name));
-      else
-        return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
-                                 "there is already a file named '%s'", name);
-    }
+  SVN_ERR(svn_io_remove_dir2(name, TRUE, NULL, NULL, pool));
 
   SVN_ERR(svn_repos_create(&repos, name, NULL, NULL, NULL,
                            fs_config, pool));


Reply via email to