All pastes #28836 Raw Edit

Miscellany

public text v1 · immutable
#28836 ·published 2005-11-15 20:49 UTC
rendered paste body
Index: subversion/libsvn_subr/io.c
===================================================================
--- subversion/libsvn_subr/io.c (revision 17364)
+++ subversion/libsvn_subr/io.c (working copy)
@@ -2479,38 +2479,14 @@
  
 #ifdef WIN32
   /* Set the file writable but only on Windows, because Windows will
-     not allow us to rename files that are read-only. But preserve the
-     state of the read-only flag on the destination. */
-  svn_boolean_t was_read_only;
-  apr_finfo_t finfo;
+     not allow us to rename files that are read-only. */
  
-  SVN_ERR (svn_io_set_file_read_write (from_path, FALSE, pool));
+  SVN_ERR (svn_io_set_file_read_write (to_path, FALSE, pool));
 #endif /* WIN32 */
  
   SVN_ERR (svn_path_cstring_from_utf8 (&from_path_apr, from_path, pool));
   SVN_ERR (svn_path_cstring_from_utf8 (&to_path_apr, to_path, pool));
  
-#ifdef WIN32
-  status = apr_stat (&finfo, to_path_apr, APR_FINFO_PROT, pool);
-  if (APR_STATUS_IS_ENOENT (status))
-    {
-      was_read_only = FALSE;
-      status = APR_SUCCESS;
-    }
-  else if (!status)
-    {
-      /* Note: apr_stat doesn't look at just the read-only bit. It's
-         concievable that we get a positive result here because of
-         file permissions. But that shouldn't happen in a Subversion
-         working copy, and then set_read_write will fail, so the end
-         result is the same. */
-      was_read_only = !(finfo.protection
-                        & (APR_UWRITE | APR_GWRITE | APR_WWRITE));
-      if (was_read_only)
-        SVN_ERR (svn_io_set_file_read_write (to_path, FALSE, pool));
-    }
-#endif /* WIN32 */
-
   if (!status)
     {
       status = apr_file_rename (from_path_apr, to_path_apr, pool);
@@ -2523,11 +2499,6 @@
                                svn_path_local_style (from_path, pool),
                                svn_path_local_style (to_path, pool));
  
-#ifdef WIN32
-  if (was_read_only)
-    SVN_ERR (svn_io_set_file_read_only (to_path, FALSE, pool));
-#endif /* WIN32 */
-
   return SVN_NO_ERROR;
 }