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.

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  <tytso@rsts-11.mit.edu>
+
+	* 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  <tytso@rsts-11.mit.edu>
 
 	* 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 @@
 			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 @@
 			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 @@
 	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;