From 83e6ac84c7784ba66eaf5d4998bad2f26d1519ed Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Mon, 30 Jul 2001 16:29:52 -0400 Subject: [PATCH] unix.c (check_mount): Remove the code in e2fsck which tested for the root filesystem being mounted read-only, and depend on the results flags from ext2fs_check_if_mounted. --- e2fsck/ChangeLog | 6 ++++++ e2fsck/unix.c | 21 +++++++-------------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog index b3089f2..9b7f0af 100644 --- a/e2fsck/ChangeLog +++ b/e2fsck/ChangeLog @@ -1,3 +1,9 @@ +2001-07-30 Theodore Tso + + * unix.c (check_mount): Remove the code which tested for the root + filesystem being mounted read-only, and depend on the + results flags from ext2fs_check_if_mounted. + 2001-07-29 Theodore Tso * unix.c (check_if_skip): Free the e2fsck context structure on a diff --git a/e2fsck/unix.c b/e2fsck/unix.c index dc5c39e..0554c8b 100644 --- a/e2fsck/unix.c +++ b/e2fsck/unix.c @@ -210,23 +210,16 @@ static void check_mount(e2fsck_t ctx) ctx->filesystem_name); return; } - if (!(mount_flags & EXT2_MF_MOUNTED)) - return; -#if (defined(__linux__) && defined(HAVE_MNTENT_H)) /* - * If the root is mounted read-only, then /etc/mtab is - * probably not correct; so we won't issue a warning based on - * it. + * If the filesystem isn't mounted, or it's the root filesystem + * and it's mounted read-only, then everything's fine. */ - fd = open(MOUNTED, O_RDWR); - if (fd < 0) { - if (errno == EROFS) - return; - } else - close(fd); -#endif - + if ((!(mount_flags & EXT2_MF_MOUNTED)) || + ((mount_flags & EXT2_MF_ISROOT) && + (mount_flags & EXT2_MF_READONLY))) + return; + if (ctx->options & E2F_OPT_READONLY) { printf(_("Warning! %s is mounted.\n"), ctx->filesystem_name); return; -- 1.8.3.1