ChangeLog, util.c:
  util.c (fatal_error): Check to make sure the io_manager data structure
  	is sane before trying to flush the io_channel.  (From Andreas Dilger)

diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog
index 4a473ed..df1d0c2 100644
--- a/e2fsck/ChangeLog
+++ b/e2fsck/ChangeLog
@@ -1,5 +1,9 @@
 2001-01-12  Theodore Ts'o  <tytso@valinux.com>
 
+	* util.c (fatal_error): Check to make sure the io_manager data
+		structure is sane before trying to flush the io_channel.
+		(From Andreas Dilger)
+
 	* pass2.c: Minor whitespace cleanups, from Andreas Dilger.
 
 	* journal.c (e2fsck_journal_fix_bad_inode): Set pctx->ino to the
diff --git a/e2fsck/util.c b/e2fsck/util.c
index 1e2f9f0..517aa6e 100644
--- a/e2fsck/util.c
+++ b/e2fsck/util.c
@@ -41,6 +41,12 @@
 		fprintf (stderr, "e2fsck: %s\n", msg);
 	if (ctx->fs && ctx->fs->io)
 		io_channel_flush(ctx->fs->io);
+	if (ctx->fs && ctx->fs->io) {
+		if (ctx->fs->io->magic == EXT2_ET_MAGIC_IO_MANAGER)
+			io_channel_flush(ctx->fs->io);
+		else
+			fprintf(stderr, "e2fsck: io manager magic bad!\n");
+	}
 	ctx->flags |= E2F_FLAG_ABORT;
 	if (ctx->flags & E2F_FLAG_SETJMP_OK)
 		longjmp(ctx->abort_loc, 1);