Skip to contentSkip to conversation

Correct the return values in squashfs probe

PATCH Applied David Shea 2 participants 2 messages Jun 23, 2014 – Jun 24, 2014 Util-Linux package

lore
Share & tools
lore

David Shea

author
#0 lore raw

PATCH 1/1 Correct the return values in squashfs probe

Returning -1 can cause squashfs v3 detection to make v4 detection fail.

---
 libblkid/src/superblocks/squashfs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
libblkid/src/superblocks/squashfs.c +3 -3
index a35d60f..c8f9641 100644
@@ -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 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);
 
Signature · 1 line
2.0.0
maintainer Applied
#1 lore raw
Quoted 2 lines · David Shea
 libblkid/src/superblocks/squashfs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Applied, thanks.

libblkid/src/superblocks/squashfs.c static int probe_squashfs3(blkid_probe pr, const struct blkid_idmag *mag) · line 59

Quoted 4 lines
libblkid/src/superblocks/squashfs.c +1 -1
 	sq = blkid_probe_get_sb(pr, mag, struct sqsh_super_block);
 	if (!sq)
-		return -1;
+		return 1;

Note that the current libblkid code is sensitive to IO errors, so the correct changes is

        return errno ? -errno : 1;

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com