subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1240752 - /subversion/trunk/subversion/libsvn_subr/io.c
Date Sun, 05 Feb 2012 15:48:57 GMT
Author: stefan2
Date: Sun Feb  5 15:48:56 2012
New Revision: 1240752

URL: http://svn.apache.org/viewvc?rev=1240752&view=rev
Log:
Workaround of an APR flaw that can cause FSFS corruption
if representation sharing has been enabled. We must first
flush write buffers and *then* remove data from the file.

* subversion/libsvn_subr/io.c
  (svn_io_file_trunc): make sure that stale data does not get written

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=1240752&r1=1240751&r2=1240752&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/io.c (original)
+++ subversion/trunk/subversion/libsvn_subr/io.c Sun Feb  5 15:48:56 2012
@@ -3280,6 +3280,15 @@ svn_io_write_unique(const char **tmp_pat
 svn_error_t *
 svn_io_file_trunc(apr_file_t *file, apr_off_t offset, apr_pool_t *pool)
 {
+  /* This is a work-around. APR would flush the write buffer
+     _after_ truncating the file causing now invalid buffered
+     data to be written behind OFFSET. */
+  SVN_ERR(do_io_file_wrapper_cleanup
+    (file, apr_file_flush(file),
+     N_("Can't flush file '%s'"),
+     N_("Can't flush stream"),
+     pool));
+
   return do_io_file_wrapper_cleanup
     (file, apr_file_trunc(file, offset),
      N_("Can't truncate file '%s'"),



Mime
View raw message