[haiku-commits] r36263 - haiku/trunk/src/add-ons/kernel/file_systems/bfs

  • From: axeld@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 14 Apr 2010 16:36:02 +0200 (CEST)

Author: axeld
Date: 2010-04-14 16:36:02 +0200 (Wed, 14 Apr 2010)
New Revision: 36263
Changeset: http://dev.haiku-os.org/changeset/36263/haiku

Modified:
   haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.cpp
Log:
* Fill the gap between a write and the former file size with zeros, too.


Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.cpp
===================================================================
--- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.cpp   2010-04-14 
14:30:34 UTC (rev 36262)
+++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.cpp   2010-04-14 
14:36:02 UTC (rev 36263)
@@ -1565,7 +1565,9 @@
                writeLocker.Lock();
        }
 
-       if (pos + length > Size()) {
+       off_t oldSize = Size();
+
+       if (pos + length > oldSize) {
                // let's grow the data stream to the size needed
                status_t status = SetFileSize(transaction, pos + length);
                if (status != B_OK) {
@@ -1589,6 +1591,9 @@
 
        writeLocker.Unlock();
 
+       if (oldSize < pos)
+               FillGapWithZeros(oldSize, pos);
+
        // If we don't want to write anything, we can now return (we may
        // just have changed the file size using the position parameter)
        if (length == 0)


Other related posts:

  • » [haiku-commits] r36263 - haiku/trunk/src/add-ons/kernel/file_systems/bfs - axeld