diff options
Diffstat (limited to 'fsck')
-rw-r--r-- | fsck/fsck.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/fsck/fsck.c b/fsck/fsck.c index e11bbe9b..66c027c7 100644 --- a/fsck/fsck.c +++ b/fsck/fsck.c @@ -847,6 +847,22 @@ static int fs_match(struct fs_info *fs, struct fs_type_compile *cmp) return (cmp->negate ? !ret : ret); } +/* + * Check if a device exists + */ +static int device_exists(const char *device) +{ + struct stat st; + + if (stat(device, &st) == -1) + return 0; + + if (!S_ISBLK(st.st_mode)) + return 0; + + return 1; +} + /* Check if we should ignore this filesystem. */ static int ignore(struct fs_info *fs) { @@ -869,6 +885,15 @@ static int ignore(struct fs_info *fs) return 1; } + /* + * ignore devices that don't exist and have the "nofail" mount option + */ + if (!device_exists(fs->device) && opt_in_list("nofail", fs->opts)) { + if (verbose) + printf(_("%s: skipping nonexistent device\n"), fs->device); + return 1; + } + interpret_type(fs); /* |