]> git.ipfire.org Git - thirdparty/util-linux.git/blobdiff - fsck/fsck.c
fsck: make fs->type usage more robust [smatch scan]
[thirdparty/util-linux.git] / fsck / fsck.c
index 8ac43bea42b985a8edbe91021c5e5ac0532269c6..7eb5f0203dbbef95050d3700a70d18cea50a1c62 100644 (file)
@@ -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) {