diff options
author | Theodore Ts'o <tytso@mit.edu> | 2000-07-06 14:16:08 +0000 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2000-07-06 14:16:08 +0000 |
commit | 5b1519bf528182fff35b8786455182ec018c454e (patch) | |
tree | ede429844e83980e79faa38f53fe6076e54f0715 /misc | |
parent | 981dc56ae312ef6f13ab5fca57ef51616890e13f (diff) | |
download | e2fsprogs-5b1519bf528182fff35b8786455182ec018c454e.tar.gz |
ChangeLog, fsck.c:
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.
Diffstat (limited to 'misc')
-rw-r--r-- | misc/ChangeLog | 7 | ||||
-rw-r--r-- | misc/fsck.c | 16 |
2 files changed, 22 insertions, 1 deletions
diff --git a/misc/ChangeLog b/misc/ChangeLog index 2183e8db..ab2734ca 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -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. diff --git a/misc/fsck.c b/misc/fsck.c index c9ed7694..8270675c 100644 --- a/misc/fsck.c +++ b/misc/fsck.c @@ -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; |