From b8647faa3b0a7dfbb2456a7b37321ee4bbda651c Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Thu, 20 Nov 1997 21:52:43 +0000 Subject: [PATCH] ChangeLog, pass3.c: Fix bug which could cause core dump when expanding the directory, and the bitmaps hadn't yet been read in. Also, only use ext2fs_write_dir_block when writing a directory block, not when writing out a fresh indirect block. --- e2fsck/ChangeLog | 8 ++++++++ e2fsck/pass3.c | 9 ++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog index 834eb4e..5370bfb 100644 --- a/e2fsck/ChangeLog +++ b/e2fsck/ChangeLog @@ -1,3 +1,11 @@ +Thu Nov 20 16:02:23 1997 Theodore Ts'o + + * pass3.c (expand_directory): Fix bug which could cause core dump + when expanding the directory, and the bitmaps hadn't yet + been read in. Also, only use ext2fs_write_dir_block when + writing a directory block, not when writing out a fresh + indirect block. + Wed Nov 19 16:15:44 1997 Theodore Ts'o * pass1.c (process_bad_block): Fix bug where first_block wasn't diff --git a/e2fsck/pass3.c b/e2fsck/pass3.c index 9af3be7..300d52e 100644 --- a/e2fsck/pass3.c +++ b/e2fsck/pass3.c @@ -635,6 +635,7 @@ static int expand_dir_proc(ext2_filsys fs, return BLOCK_ABORT; } es->done = 1; + retval = ext2fs_write_dir_block(fs, new_blk, block); } else { retval = ext2fs_get_mem(fs->blocksize, (void **) &block); if (retval) { @@ -642,8 +643,8 @@ static int expand_dir_proc(ext2_filsys fs, return BLOCK_ABORT; } memset(block, 0, fs->blocksize); + retval = io_channel_write_blk(fs->io, new_blk, 1, block); } - retval = ext2fs_write_dir_block(fs, new_blk, block); if (retval) { es->err = retval; return BLOCK_ABORT; @@ -669,6 +670,12 @@ static errcode_t expand_directory(e2fsck_t ctx, ino_t dir) if (!(fs->flags & EXT2_FLAG_RW)) return EXT2_ET_RO_FILSYS; + /* + * Read the inode and block bitmaps in; we'll be messing with + * them. + */ + e2fsck_read_bitmaps(ctx); + retval = ext2fs_check_directory(fs, dir); if (retval) return retval; -- 1.8.3.1