You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ko...@apache.org on 2015/01/23 14:56:44 UTC

svn commit: r1654213 - /subversion/trunk/subversion/libsvn_subr/io.c

Author: kotkov
Date: Fri Jan 23 13:56:44 2015
New Revision: 1654213

URL: http://svn.apache.org/r1654213
Log:
Simplify the ENOENT handling within svn_io_remove_file2().

On Windows, this function might call apr_file_remove() more than once due
to a special handling of access denied errors.  However, handling access
denied errors doesn't somehow intersect with ENOENTs, so we can check for
ENOENT only once.  Do that right before exiting from the function.

See the related discussion in http://svn.haxx.se/dev/archive-2015-01/0121.shtml
Message-ID:<CA...@mail.gmail.com>

* subversion/libsvn_subr/io.c
  (svn_io_remove_file2): Consolidate two checks into one and perform it when
   we are about to return from this function.  The corresponding explanatory
   comment is no longer required.  While here, also make the conditional
   statements a bit more readable by splitting them.

Modified:
    subversion/trunk/subversion/libsvn_subr/io.c

Modified: subversion/trunk/subversion/libsvn_subr/io.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/io.c?rev=1654213&r1=1654212&r2=1654213&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/io.c (original)
+++ subversion/trunk/subversion/libsvn_subr/io.c Fri Jan 23 13:56:44 2015
@@ -2456,11 +2456,6 @@ svn_io_remove_file2(const char *path,
   SVN_ERR(cstring_from_utf8(&path_apr, path, scratch_pool));
 
   apr_err = apr_file_remove(path_apr, scratch_pool);
-  if (!apr_err
-      || (ignore_enoent
-          && (APR_STATUS_IS_ENOENT(apr_err)
-              || SVN__APR_STATUS_IS_ENOTDIR(apr_err))))
-    return SVN_NO_ERROR;
 
 #ifdef WIN32
   /* If the target is read only NTFS reports EACCESS and FAT/FAT32
@@ -2495,16 +2490,20 @@ svn_io_remove_file2(const char *path,
     }
 #endif
 
-  /* On Windows EACCESS at the start could be followed by ENOENT from
-     the retry so repeat the ignore_enoent check. */
-  if (apr_err
-      && !(ignore_enoent
-           && (APR_STATUS_IS_ENOENT(apr_err)
-               || SVN__APR_STATUS_IS_ENOTDIR(apr_err))))
-    return svn_error_wrap_apr(apr_err, _("Can't remove file '%s'"),
-                              svn_dirent_local_style(path, scratch_pool));
-
-  return SVN_NO_ERROR;
+  if (!apr_err)
+    {
+      return SVN_NO_ERROR;
+    }
+  else if (ignore_enoent && (APR_STATUS_IS_ENOENT(apr_err)
+                             || SVN__APR_STATUS_IS_ENOTDIR(apr_err)))
+    {
+      return SVN_NO_ERROR;
+    }
+  else
+    {
+      return svn_error_wrap_apr(apr_err, _("Can't remove file '%s'"),
+                                svn_dirent_local_style(path, scratch_pool));
+    }
 }