From c1637bd371bc4eb387443752a74e68142d609690 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Fri, 8 Nov 2002 15:55:17 -0500 Subject: [PATCH] unix.c (main): Fix a bug where e2fsck could erroneously mark a filesystem as being valid if it was being checked and it is interrupted with a ^C. (Bug introduced in e2fsprogs 1.28.) --- e2fsck/ChangeLog | 5 +++++ e2fsck/unix.c | 25 +++++++++++++------------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog index 9c7a43c..80daf71 100644 --- a/e2fsck/ChangeLog +++ b/e2fsck/ChangeLog @@ -1,5 +1,10 @@ 2002-11-08 + * unix.c (main): Fix a bug where e2fsck could erroneously mark a + filesystem as being valid if it was being checked and it + is interrupted with a ^C. (Bug introduced in e2fsprogs + 1.28.) + * unix.c (PRS), journal.c: Set the default level of journal debugging to be 0, and allow the user to set the level of journal debugging by using the E2FSCK_JBD_DEBUG diff --git a/e2fsck/unix.c b/e2fsck/unix.c index 241f048..96fe4f3 100644 --- a/e2fsck/unix.c +++ b/e2fsck/unix.c @@ -1073,21 +1073,22 @@ restart: exit_value |= FSCK_UNCORRECTED; exit_value &= ~FSCK_NONDESTRUCT; } - if (!(ctx->options & E2F_OPT_READONLY)) { - if (ext2fs_test_valid(fs)) { - if (!(sb->s_state & EXT2_VALID_FS)) - exit_value |= FSCK_NONDESTRUCT; - sb->s_state = EXT2_VALID_FS; - } else - sb->s_state &= ~EXT2_VALID_FS; - sb->s_mnt_count = 0; - sb->s_lastcheck = time(NULL); - ext2fs_mark_super_dirty(fs); - } if (exit_value & FSCK_CANCELED) exit_value &= ~FSCK_NONDESTRUCT; - else + else { show_stats(ctx); + if (!(ctx->options & E2F_OPT_READONLY)) { + if (ext2fs_test_valid(fs)) { + if (!(sb->s_state & EXT2_VALID_FS)) + exit_value |= FSCK_NONDESTRUCT; + sb->s_state = EXT2_VALID_FS; + } else + sb->s_state &= ~EXT2_VALID_FS; + sb->s_mnt_count = 0; + sb->s_lastcheck = time(NULL); + ext2fs_mark_super_dirty(fs); + } + } e2fsck_write_bitmaps(ctx); -- 1.8.3.1