Whamcloud - gitweb
ChangeLog, fsck.c:
authorTheodore Ts'o <tytso@mit.edu>
Thu, 6 Jul 2000 14:16:08 +0000 (14:16 +0000)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 6 Jul 2000 14:16:08 +0000 (14:16 +0000)
  fsck.c (lookup, load_fs_info, check_all): Use lazy evaluation for
   calling interpret_device(), since this requires root privileges if the
   partitions need to be scanned.  Otherwise, it's not possible to do
   non-proot fsck's for removeable devices such as floppies if there are
   any LABEL= or UUID= entries in /etc/fstab.

misc/ChangeLog
misc/fsck.c

index 2183e8d..ab2734c 100644 (file)
@@ -1,5 +1,12 @@
 2000-07-06  Theodore Ts'o  <tytso@valinux.com>
 
+       * fsck.c (lookup, load_fs_info, check_all): Use lazy evaluation
+               for calling interpret_device(), since this requires root
+               privileges if the partitions need to be scanned.
+               Otherwise, it's not possible to do non-proot fsck's for
+               removeable devices such as floppies if there are any
+               LABEL= or UUID= entries in /etc/fstab.
+
        * badblocks.c (check_mount, main): Check to see if the filesystem
                is mounted before doing a read/write or non-destructive
                test.  This can be overriden using the new -f option.
index c9ed769..8270675 100644 (file)
@@ -315,7 +315,6 @@ static void load_fs_info(const char *filename)
                }
                if (!fs)
                        continue;
-               fs->device = interpret_device(fs->device);
                if (!filesys_info)
                        filesys_info = fs;
                else
@@ -345,12 +344,25 @@ static void load_fs_info(const char *filename)
 static struct fs_info *lookup(char *filesys)
 {
        struct fs_info *fs;
+       int     try_again = 0;
 
        /* No filesys name given. */
        if (filesys == NULL)
                return NULL;
 
        for (fs = filesys_info; fs; fs = fs->next) {
+               if (strchr(fs->device, '='))
+                       try_again++;
+               if (!strcmp(filesys, fs->device) ||
+                   !strcmp(filesys, fs->mountpt))
+                       break;
+       }
+
+       if (fs || !try_again)
+               return fs;
+
+       for (fs = filesys_info; fs; fs = fs->next) {
+               fs->device = interpret_device(fs->device);
                if (!strcmp(filesys, fs->device) ||
                    !strcmp(filesys, fs->mountpt))
                        break;
@@ -752,6 +764,7 @@ static int check_all(NOARGS)
                                break;
                }
                if (fs && !skip_root && !ignore(fs)) {
+                       fs->device = interpret_device(fs->device);
                        fsck_device(fs->device, 1);
                        fs->flags |= FLAG_DONE;
                        status |= wait_all();
@@ -797,6 +810,7 @@ static int check_all(NOARGS)
                        /*
                         * Spawn off the fsck process
                         */
+                       fs->device = interpret_device(fs->device);
                        fsck_device(fs->device, serialize);
                        fs->flags |= FLAG_DONE;