From 64508976857cc38dc0d9db73a82a84bcd8eb8b31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 1 Jul 2008 11:24:48 +0000 Subject: [PATCH] * Fixed a pretty dumb copy&paste error that prevented (/double/triple) indirect blocks from working. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26189 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/file_systems/ext2/Inode.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/add-ons/kernel/file_systems/ext2/Inode.cpp b/src/add-ons/kernel/file_systems/ext2/Inode.cpp index 6bf73e83cd..71b9d3e6cc 100644 --- a/src/add-ons/kernel/file_systems/ext2/Inode.cpp +++ b/src/add-ons/kernel/file_systems/ext2/Inode.cpp @@ -105,8 +105,9 @@ Inode::FindBlock(off_t offset, uint32& block) } else if ((index -= EXT2_DIRECT_BLOCKS) < perBlock) { // indirect blocks CachedBlock cached(fVolume); - uint32* indirectBlocks = (uint32*)cached.SetTo(Node().stream.indirect); - if (indirectBlocks != NULL) + uint32* indirectBlocks = (uint32*)cached.SetTo(B_LENDIAN_TO_HOST_INT32( + Node().stream.indirect)); + if (indirectBlocks == NULL) return B_IO_ERROR; block = B_LENDIAN_TO_HOST_INT32(indirectBlocks[index]); @@ -115,12 +116,12 @@ Inode::FindBlock(off_t offset, uint32& block) CachedBlock cached(fVolume); uint32* indirectBlocks = (uint32*)cached.SetTo(B_LENDIAN_TO_HOST_INT32( Node().stream.double_indirect)); - if (indirectBlocks != NULL) + if (indirectBlocks == NULL) return B_IO_ERROR; indirectBlocks = (uint32*)cached.SetTo(B_LENDIAN_TO_HOST_INT32( indirectBlocks[index / perBlock])); - if (indirectBlocks != NULL) + if (indirectBlocks == NULL) return B_IO_ERROR; block = B_LENDIAN_TO_HOST_INT32(indirectBlocks[index & (perBlock - 1)]); @@ -129,17 +130,17 @@ Inode::FindBlock(off_t offset, uint32& block) CachedBlock cached(fVolume); uint32* indirectBlocks = (uint32*)cached.SetTo(B_LENDIAN_TO_HOST_INT32( Node().stream.triple_indirect)); - if (indirectBlocks != NULL) + if (indirectBlocks == NULL) return B_IO_ERROR; indirectBlocks = (uint32*)cached.SetTo(B_LENDIAN_TO_HOST_INT32( indirectBlocks[index / perIndirectBlock])); - if (indirectBlocks != NULL) + if (indirectBlocks == NULL) return B_IO_ERROR; indirectBlocks = (uint32*)cached.SetTo(B_LENDIAN_TO_HOST_INT32( indirectBlocks[(index / perBlock) & (perBlock - 1)])); - if (indirectBlocks != NULL) + if (indirectBlocks == NULL) return B_IO_ERROR; block = B_LENDIAN_TO_HOST_INT32(indirectBlocks[index & (perBlock - 1)]);