From 577b70d724ae7f12c4730ad76f94a6c3ac832daa Mon Sep 17 00:00:00 2001 From: jthomas Date: Sat, 7 Aug 2004 06:48:58 +0000 Subject: [PATCH] - patch from Michael Hohnbaum to handle sparse files. --- ChangeLog | 4 ++++ stage2/fsys_ext2fs.c | 12 ++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index d4c3d6a0d..cda87fcdf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2004-08-07 Jason Thomas + From Michael Hohnbaum : + * stage2/fsys_ext2fs.c (ext2fs_read): Handle sparse files. + 2004-07-24 Yoshinori K. Okuji * stage2/stage2.c (cmain): Terminate DEFAULT_FILE with NUL diff --git a/stage2/fsys_ext2fs.c b/stage2/fsys_ext2fs.c index ef3770096..560048f4c 100644 --- a/stage2/fsys_ext2fs.c +++ b/stage2/fsys_ext2fs.c @@ -432,12 +432,16 @@ ext2fs_read (char *buf, int len) if (size > len) size = len; - disk_read_func = disk_read_hook; + if (map == 0) { + memset ((char *) buf, 0, size); + } else { + disk_read_func = disk_read_hook; - devread (map * (EXT2_BLOCK_SIZE (SUPERBLOCK) / DEV_BSIZE), - offset, size, buf); + devread (map * (EXT2_BLOCK_SIZE (SUPERBLOCK) / DEV_BSIZE), + offset, size, buf); - disk_read_func = NULL; + disk_read_func = NULL; + } buf += size; len -= size;