summaryrefslogtreecommitdiffstats
path: root/fsck/fsck.c
diff options
context:
space:
mode:
authorKarel Zak2012-01-17 17:28:46 +0100
committerKarel Zak2012-01-17 17:28:46 +0100
commit3d4820f4d1cac4dc87b9d9e197d8f889c1997376 (patch)
tree73a7b4f3952887082361335b783bf7f3a0ad6102 /fsck/fsck.c
parentblockdev: remove non-ANSI function declaration [smatch scan] (diff)
downloadkernel-qcow2-util-linux-3d4820f4d1cac4dc87b9d9e197d8f889c1997376.tar.gz
kernel-qcow2-util-linux-3d4820f4d1cac4dc87b9d9e197d8f889c1997376.tar.xz
kernel-qcow2-util-linux-3d4820f4d1cac4dc87b9d9e197d8f889c1997376.zip
fsck: make fs->type usage more robust [smatch scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'fsck/fsck.c')
-rw-r--r--fsck/fsck.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fsck/fsck.c b/fsck/fsck.c
index 8ac43bea4..7eb5f0203 100644
--- a/fsck/fsck.c
+++ b/fsck/fsck.c
@@ -421,7 +421,7 @@ static void interpret_type(struct fs_info *fs)
{
char *t;
- if (strcmp(fs->type, "auto") != 0)
+ if (fs->type && strcmp(fs->type, "auto") != 0)
return;
t = fsprobe_get_fstype_by_devname(fs->device);
if (t) {
@@ -1030,12 +1030,16 @@ static int ignore(struct fs_info *fs)
* If a specific fstype is specified, and it doesn't match,
* ignore it.
*/
- if (!fs_match(fs, &fs_type_compiled)) return 1;
+ if (!fs_match(fs, &fs_type_compiled))
+ return 1;
/* Are we ignoring this type? */
if (fs->type && ignored_type(fs->type))
return 1;
+ if (!fs->type)
+ return 0; /* should not happen */
+
/* Do we really really want to check this fs? */
for(ip = really_wanted; *ip; ip++)
if (strcmp(fs->type, *ip) == 0) {