[Haiku-commits] r30960 - haiku/trunk/src/system/kernel/cache

axeld at BerliOS axeld at mail.berlios.de
Thu Jun 4 14:29:16 CEST 2009


Author: axeld
Date: 2009-06-04 14:29:15 +0200 (Thu, 04 Jun 2009)
New Revision: 30960
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30960&view=rev

Modified:
   haiku/trunk/src/system/kernel/cache/file_map.cpp
Log:
* Fixed a bug that let _InvalidateAfter() access already freed memory, and would
  also mess up the file map, causing all sorts of file corruption.
* This fixes bug #3991 (and eventually some others).


Modified: haiku/trunk/src/system/kernel/cache/file_map.cpp
===================================================================
--- haiku/trunk/src/system/kernel/cache/file_map.cpp	2009-06-04 12:27:09 UTC (rev 30959)
+++ haiku/trunk/src/system/kernel/cache/file_map.cpp	2009-06-04 12:29:15 UTC (rev 30960)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004-2008, Axel Dörfler, axeld at pinc-software.de.
+ * Copyright 2004-2009, Axel Dörfler, axeld at pinc-software.de.
  * Distributed under the terms of the MIT License.
  */
 
@@ -280,13 +280,15 @@
 	uint32 index;
 	file_extent* extent = _FindExtent(offset, &index);
 	if (extent != NULL) {
-		_MakeSpace(index + 1);
+		uint32 resizeTo = index + 1;
 
 		if (extent->offset + extent->disk.length > offset) {
 			extent->disk.length = offset - extent->offset;
 			if (extent->disk.length == 0)
-				_MakeSpace(index);
+				resizeTo = index;
 		}
+
+		_MakeSpace(resizeTo);
 	}
 }
 




More information about the Haiku-commits mailing list