Fixed another stupid bug in the file cache: when the first read was a partial

read over two blocks, some memory behind that memory could be trashed.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9188 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2004-10-04 21:03:31 +00:00
parent 8cd742e41b
commit 57bf060563
+3 -2
View File
@@ -166,6 +166,7 @@ readwrite_pages(file_cache_ref *ref, off_t offset, const iovec *vecs, size_t cou
totalSize += size; totalSize += size;
} }
return B_OK; return B_OK;
} }
@@ -173,7 +174,7 @@ readwrite_pages(file_cache_ref *ref, off_t offset, const iovec *vecs, size_t cou
static status_t static status_t
read_from_cache(file_cache_ref *ref, off_t offset, size_t size, addr_t buffer, size_t bufferSize) read_from_cache(file_cache_ref *ref, off_t offset, size_t size, addr_t buffer, size_t bufferSize)
{ {
TRACE(("read_from_cache: ref = %p, offset = %Ld, size = %lu\n", ref, offset, bufferSize)); TRACE(("read_from_cache: ref = %p, offset = %Ld, size = %lu, buffer = %p, bufferSize = %lu\n", ref, offset, size, (void *)buffer, bufferSize));
iovec vecs[MAX_IO_VECS]; iovec vecs[MAX_IO_VECS];
int32 vecCount = 0; int32 vecCount = 0;
@@ -382,7 +383,7 @@ readwrite(void *_cacheRef, off_t offset, addr_t bufferBase, size_t *_size, bool
vm_put_physical_page(virtualAddress); vm_put_physical_page(virtualAddress);
bufferBase += B_PAGE_SIZE; bufferBase += B_PAGE_SIZE - pageOffset;
pageOffset = 0; pageOffset = 0;
if (bytesLeft <= B_PAGE_SIZE) { if (bytesLeft <= B_PAGE_SIZE) {