From ae6cdcf74a4c665b7404374bf52e0c91c31422a9 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Wed, 19 Sep 2001 15:17:25 -0400 Subject: [PATCH] e2fsck: If a superblock is specified explicitly by the user, don't try to automatically fall back to an alternate superblock. --- e2fsck/ChangeLog | 6 ++++++ e2fsck/e2fsck.h | 2 ++ e2fsck/unix.c | 4 +++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog index 1c7159b..7787e11 100644 --- a/e2fsck/ChangeLog +++ b/e2fsck/ChangeLog @@ -1,3 +1,9 @@ +2001-09-19 Theodore Tso + + * unix.c (main): If a superblock is specified explicitly by the + user, don't try to automatically fall back to an + alternate superblock. + 2001-09-02 Theodore Tso * Release of E2fsprogs 1.24a diff --git a/e2fsck/e2fsck.h b/e2fsck/e2fsck.h index fe2537c..0541ab1 100644 --- a/e2fsck/e2fsck.h +++ b/e2fsck/e2fsck.h @@ -115,6 +115,8 @@ struct resource_track { #define E2F_FLAG_PROG_BAR 0x0020 /* Progress bar on screen */ #define E2F_FLAG_PROG_SUPPRESS 0x0040 /* Progress suspended */ #define E2F_FLAG_JOURNAL_INODE 0x0080 /* Create a new ext3 journal inode */ +#define E2F_FLAG_SB_SPECIFIED 0x0100 /* The superblock was explicitly + * specified by the user */ /* * Defines for indicating the e2fsck pass number diff --git a/e2fsck/unix.c b/e2fsck/unix.c index c15b1d3..fb48f2b 100644 --- a/e2fsck/unix.c +++ b/e2fsck/unix.c @@ -520,6 +520,7 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx) break; case 'b': ctx->use_superblock = atoi(optarg); + ctx->flags |= E2F_FLAG_SB_SPECIFIED; break; case 'B': blocksize = atoi(optarg); @@ -746,7 +747,8 @@ restart: } else retval = ext2fs_open(ctx->filesystem_name, flags, 0, 0, io_ptr, &fs); - if (!ctx->superblock && !(ctx->options & E2F_OPT_PREEN) && + if (!ctx->superblock && !(ctx->options & E2F_OPT_PREEN) && + !(ctx->flags & E2F_FLAG_SB_SPECIFIED) && ((retval == EXT2_ET_BAD_MAGIC) || ((retval == 0) && ext2fs_check_desc(fs)))) { if (!fs || (fs->group_desc_count > 1)) { -- 1.8.3.1