]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: correct the return values in squashfs probe
authorDavid Shea <dshea@redhat.com>
Mon, 23 Jun 2014 17:41:48 +0000 (13:41 -0400)
committerKarel Zak <kzak@redhat.com>
Tue, 24 Jun 2014 08:54:48 +0000 (10:54 +0200)
Returning -1 can cause squashfs v3 detection to make v4 detection fail.

Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid/src/superblocks/squashfs.c

index a35d60faf05b3ad60948efbb0a1aa36097bc90a5..8ed28385fb13b0c094bd6d427722181266d9a602 100644 (file)
@@ -41,7 +41,7 @@ static int probe_squashfs(blkid_probe pr, const struct blkid_idmag *mag)
        major = le16_to_cpu(sq->s_major);
        minor = le16_to_cpu(sq->s_minor);
        if (major < 4)
-               return -1;
+               return 1;
 
        blkid_probe_sprintf_version(pr, "%u.%u", major, minor);
 
@@ -56,7 +56,7 @@ static int probe_squashfs3(blkid_probe pr, const struct blkid_idmag *mag)
 
        sq = blkid_probe_get_sb(pr, mag, struct sqsh_super_block);
        if (!sq)
-               return -1;
+               return errno ? -errno : 1;
 
        if (strcmp(mag->magic, "sqsh") == 0) {
                major = be16_to_cpu(sq->s_major);
@@ -67,7 +67,7 @@ static int probe_squashfs3(blkid_probe pr, const struct blkid_idmag *mag)
        }
 
        if (major > 3)
-               return -1;
+               return 1;
 
        blkid_probe_sprintf_version(pr, "%u.%u", major, minor);