From e4eaf625553ddf07f6cade56651fda7038542ea2 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Thu, 9 Dec 2010 19:40:11 +0100 Subject: [PATCH] Small restructuring of squash_read --- grub-core/fs/squash4.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/grub-core/fs/squash4.c b/grub-core/fs/squash4.c index 8eca185f3..1a121c2cf 100644 --- a/grub-core/fs/squash4.c +++ b/grub-core/fs/squash4.c @@ -402,13 +402,12 @@ grub_squash_read (grub_file_t file, char *buf, grub_size_t len) grub_uint64_t a; struct grub_squash_data *data = file->data; - a = grub_le_to_cpu32 (data->ino.offset) + file->offset; if (grub_le_to_cpu16 (data->ino.fragment) == 0xffff) { if (grub_le_to_cpu32 (data->ino.chunk)) - a += grub_le_to_cpu32 (data->ino.chunk); + a = grub_le_to_cpu32 (data->ino.chunk); else - a += sizeof (struct grub_squash_super); + a = sizeof (struct grub_squash_super); } else { @@ -418,10 +417,11 @@ grub_squash_read (grub_file_t file, char *buf, grub_size_t len) * grub_le_to_cpu16 (data->ino.fragment)); if (err) return -1; - a += grub_le_to_cpu64 (frag.offset); - a += grub_le_to_cpu32 (data->ino.chunk); + a = grub_le_to_cpu64 (frag.offset) + grub_le_to_cpu32 (data->ino.chunk); } + a += grub_le_to_cpu32 (data->ino.offset) + file->offset; + err = grub_disk_read (file->device->disk, a >> GRUB_DISK_SECTOR_BITS, a & (GRUB_DISK_SECTOR_SIZE - 1), len, buf); if (err)