You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2013/10/31 13:19:03 UTC

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

Author: rhuijben
Date: Thu Oct 31 12:19:03 2013
New Revision: 1537466

URL: http://svn.apache.org/r1537466
Log:
* subversion/libsvn_subr/io.c
  (svn_io_write_atomic): Properly delete the tempfile when the flush or rename
    fails and produce an easier to diagnose error.

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=1537466&r1=1537465&r2=1537466&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/io.c (original)
+++ subversion/trunk/subversion/libsvn_subr/io.c Thu Oct 31 12:19:03 2013
@@ -3782,15 +3782,21 @@ svn_io_write_atomic(const char *final_pa
   if (!err && copy_perms_path)
     err = svn_io_copy_perms(copy_perms_path, tmp_path, scratch_pool);
 
+  if (!err)
+    err = svn_io_file_rename(tmp_path, final_path, scratch_pool);
+
   if (err)
     {
-      return svn_error_compose_create(err,
-                                      svn_io_remove_file2(tmp_path, FALSE,
-                                                          scratch_pool));
+      err = svn_error_compose_create(err,
+                                     svn_io_remove_file2(tmp_path, TRUE,
+                                                         scratch_pool));
+
+      return svn_error_createf(err->apr_err, err,
+                               _("Can't write '%s' atomicly"),
+                               svn_dirent_local_style(final_path,
+                                                      scratch_pool));
     }
 
-  SVN_ERR(svn_io_file_rename(tmp_path, final_path, scratch_pool));
-
 #ifdef __linux__
   {
     /* Linux has the unusual feature that fsync() on a file is not