ChangeLog, unix.c:
  unix.c (main): Reset the context before calling ext2fs_close(), to
  avoid referencing already freed memory.
ChangeLog, llseek.c:
  llseek.c (ext2fs_llseek): Change ext2fs_llseek() in the non-Linux case
  	to use EINVAL by default, unless it isn't defined, in which case we
  	use EXT2_ET_INVALID_ARGUMENT instead.
ChangeLog, mk_cmds.sh.in:
  mk_cmds.sh.in: Fixed portability bug in shell script; we were
  	depending on a bash'ism.
ChangeLog, uuid.c:
  uuid.c: Use asm/types.h instead of linux/types.h, to be consistent
  	with other locations where we've had to do this to work around glibc.

diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog
index 45bb6d5..481f372 100644
--- a/e2fsck/ChangeLog
+++ b/e2fsck/ChangeLog
@@ -1,3 +1,8 @@
+Mon Jan  4 02:28:59 1999  Theodore Y. Ts'o  <tytso@mit.edu>
+
+	* unix.c (main): Reset the context before calling ext2fs_close(),
+		to avoid referencing already freed memory.
+
 1998-12-15  Theodore Ts'o  <tytso@rsts-11.mit.edu>
 
 	* Release of E2fsprogs 1.13
diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index e17d5a3..279849f 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -646,7 +646,6 @@
 
 	run_result = e2fsck_run(ctx);
 	if (run_result == E2F_FLAG_RESTART) {
-		ext2fs_close(fs);
 		printf("Restarting e2fsck from the beginning...\n");
 		retval = e2fsck_reset_context(ctx);
 		if (retval) {
@@ -654,6 +653,7 @@
 				"while resetting context");
 			exit(1);
 		}
+		ext2fs_close(fs);
 		goto restart;
 	}
 	if (run_result & E2F_FLAG_SIGNAL_MASK)