From 22ff06d5f7a90914f7a90bae420e5be7d2e02ce3 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Mon, 5 Jul 2010 15:06:37 -0400 Subject: [PATCH] e2fsck: Add missing ext2fs_close() call when going back to original superblock In the case where the original superblock and the backup superblock are both invalid in some way, e2fsck will try to go back to the orignal superblock. To do that, it must close the attempted open using the backup superblock first (since otherwise the exclusive open will prevent the subsequent open from succeding). Signed-off-by: Dmitry Monakhov Signed-off-by: "Theodore Ts'o" --- e2fsck/unix.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/e2fsck/unix.c b/e2fsck/unix.c index 34fa9b1..4a299ef 100644 --- a/e2fsck/unix.c +++ b/e2fsck/unix.c @@ -1054,6 +1054,8 @@ restart: orig_retval = retval; retval = try_open_fs(ctx, flags, io_ptr, &fs); if ((orig_retval == 0) && retval != 0) { + if (fs) + ext2fs_close(fs); com_err(ctx->program_name, retval, "when using the backup blocks"); printf(_("%s: going back to original " -- 1.8.3.1