Whamcloud - gitweb
e2fsck.h, unix.c (main, check_mount): Fix e2fsck so that it
authorTheodore Ts'o <tytso@mit.edu>
Thu, 7 Nov 2002 21:16:55 +0000 (16:16 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 7 Nov 2002 21:16:55 +0000 (16:16 -0500)
returns the appropriate exit code, so that the boot
scripts will be told that they need to automatically
reboot.

e2fsck/ChangeLog
e2fsck/e2fsck.h
e2fsck/unix.c

index 6f8dee0..b50b25f 100644 (file)
@@ -1,3 +1,10 @@
+2002-11-07  Theodore Ts'o  <tytso@mit.edu>
+
+       * e2fsck.h, unix.c (main, check_mount): Fix e2fsck so that it
+               returns the appropriate exit code, so that the boot
+               scripts will be told that they need to automatically
+               reboot.
+
 2002-10-31  Theodore Ts'o  <tytso@mit.edu>
 
        * Release of E2fsprogs 1.30
index 9fb3922..492a231 100644 (file)
@@ -188,6 +188,7 @@ struct e2fsck_struct {
        blk_t   superblock;     /* sb used to open fs */
        int     blocksize;      /* blocksize */
        blk_t   num_blocks;     /* Total number of blocks */
+       int     mount_flags;
 
 #ifdef HAVE_SETJMP_H
        jmp_buf abort_loc;
index e3ff404..bee6636 100644 (file)
@@ -51,9 +51,6 @@ static int verbose = 0;
 static int replace_bad_blocks = 0;
 static char *bad_blocks_file = 0;
 
-static int root_filesystem = 0;
-static int read_only_root = 0;
-
 e2fsck_t e2fsck_global_ctx;    /* Try your very best not to use this! */
 
 static void usage(e2fsck_t ctx)
@@ -201,9 +198,10 @@ static void show_stats(e2fsck_t    ctx)
 static void check_mount(e2fsck_t ctx)
 {
        errcode_t       retval;
-       int             mount_flags, cont;
+       int             cont;
 
-       retval = ext2fs_check_if_mounted(ctx->filesystem_name, &mount_flags);
+       retval = ext2fs_check_if_mounted(ctx->filesystem_name,
+                                        &ctx->mount_flags);
        if (retval) {
                com_err("ext2fs_check_if_mount", retval,
                        _("while determining whether %s is mounted."),
@@ -215,9 +213,9 @@ static void check_mount(e2fsck_t ctx)
         * If the filesystem isn't mounted, or it's the root filesystem
         * and it's mounted read-only, then everything's fine.
         */
-       if ((!(mount_flags & EXT2_MF_MOUNTED)) ||
-           ((mount_flags & EXT2_MF_ISROOT) &&
-            (mount_flags & EXT2_MF_READONLY)))
+       if ((!(ctx->mount_flags & EXT2_MF_MOUNTED)) ||
+           ((ctx->mount_flags & EXT2_MF_ISROOT) &&
+            (ctx->mount_flags & EXT2_MF_READONLY)))
                return;
 
        if (ctx->options & E2F_OPT_READONLY) {
@@ -1055,7 +1053,7 @@ restart:
                if (!(ctx->options & E2F_OPT_PREEN))
                    printf(_("\n%s: ***** FILE SYSTEM WAS MODIFIED *****\n"),
                               ctx->device_name);
-               if (root_filesystem && !read_only_root) {
+               if (ctx->mount_flags & EXT2_MF_ISROOT) {
                        printf(_("%s: ***** REBOOT LINUX *****\n"),
                               ctx->device_name);
                        exit_value |= FSCK_REBOOT;