From 98a1b4c22281afddb372292e12e81780b59446b7 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Tue, 21 Jan 2014 10:10:19 +0100
Subject: [PATCH 2/2] blkid: convert superblocks to new calling convention

To correctly abort scanning when an I/O error occurs
we need to differentiate between 'error' (= -1) and
'not found' (= 1) in the probe functions.
This patch updates all superblock scanning functions
to the new calling convention.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 shlibs/blkid/src/superblocks/adaptec_raid.c   |   16 ++++--
 shlibs/blkid/src/superblocks/befs.c           |    9 ++-
 shlibs/blkid/src/superblocks/btrfs.c          |    7 ++
 shlibs/blkid/src/superblocks/cramfs.c         |    7 ++
 shlibs/blkid/src/superblocks/ddf_raid.c       |   17 +++++--
 shlibs/blkid/src/superblocks/drbd.c           |   11 +++-
 shlibs/blkid/src/superblocks/exfat.c          |    7 ++
 shlibs/blkid/src/superblocks/ext.c            |   62 +++++++++++++++++---------
 shlibs/blkid/src/superblocks/gfs.c            |   17 +++++--
 shlibs/blkid/src/superblocks/hfs.c            |   19 ++++++-
 shlibs/blkid/src/superblocks/highpoint_raid.c |   15 ++++--
 shlibs/blkid/src/superblocks/hpfs.c           |   22 +++++++--
 shlibs/blkid/src/superblocks/isw_raid.c       |   14 ++++-
 shlibs/blkid/src/superblocks/jfs.c            |    6 ++
 shlibs/blkid/src/superblocks/jmicron_raid.c   |   13 +++--
 shlibs/blkid/src/superblocks/lsi_raid.c       |   13 +++--
 shlibs/blkid/src/superblocks/luks.c           |    6 ++
 shlibs/blkid/src/superblocks/lvm.c            |   13 ++++-
 shlibs/blkid/src/superblocks/minix.c          |   25 ++++++++--
 shlibs/blkid/src/superblocks/netware.c        |    7 ++
 shlibs/blkid/src/superblocks/nilfs.c          |    9 ++-
 shlibs/blkid/src/superblocks/ntfs.c           |    7 ++
 shlibs/blkid/src/superblocks/nvidia_raid.c    |   13 +++--
 shlibs/blkid/src/superblocks/ocfs.c           |   15 +++++-
 shlibs/blkid/src/superblocks/promise_raid.c   |   12 +++--
 shlibs/blkid/src/superblocks/reiserfs.c       |   13 ++++-
 shlibs/blkid/src/superblocks/romfs.c          |    6 ++
 shlibs/blkid/src/superblocks/silicon_raid.c   |   13 +++--
 shlibs/blkid/src/superblocks/squashfs.c       |   17 +++++--
 shlibs/blkid/src/superblocks/swap.c           |    8 ++-
 shlibs/blkid/src/superblocks/sysv.c           |   13 ++++-
 shlibs/blkid/src/superblocks/ubifs.c          |    7 ++
 shlibs/blkid/src/superblocks/udf.c            |   30 +++++++++---
 shlibs/blkid/src/superblocks/ufs.c            |    6 ++
 shlibs/blkid/src/superblocks/vfat.c           |   16 +++++-
 shlibs/blkid/src/superblocks/via_raid.c       |   17 ++++---
 shlibs/blkid/src/superblocks/vmfs.c           |   13 ++++-
 shlibs/blkid/src/superblocks/vxfs.c           |    7 ++
 shlibs/blkid/src/superblocks/xfs.c            |    6 ++
 shlibs/blkid/src/superblocks/zfs.c            |    8 ++-
 40 files changed, 413 insertions(+), 129 deletions(-)

Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/adaptec_raid.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/adaptec_raid.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/adaptec_raid.c
@@ -12,6 +12,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdint.h>
+#include <errno.h>
 
 #include "superblocks.h"
 
@@ -79,22 +80,27 @@ static int probe_adraid(blkid_probe pr,
 	struct adaptec_metadata *ad;
 
 	if (pr->size < 0x10000)
-		return -1;
+		return 1;
 
 	if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
-		return -1;
+		return 1;
 
 	off = ((pr->size / 0x200)-1) * 0x200;
 	ad = (struct adaptec_metadata *)
 			blkid_probe_get_buffer(pr,
 					off,
 					sizeof(struct adaptec_metadata));
-	if (!ad)
+	if (!ad) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
+
 	if (ad->smagic != be32_to_cpu(AD_SIGNATURE))
-		return -1;
+		return 1;
 	if (ad->b0idcode != be32_to_cpu(AD_MAGIC))
-		return -1;
+		return 1;
 	if (blkid_probe_sprintf_version(pr, "%u", ad->resver) != 0)
 		return -1;
 	if (blkid_probe_set_magic(pr, off, sizeof(ad->b0idcode),
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/befs.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/befs.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/befs.c
@@ -15,6 +15,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <inttypes.h>
+#include <errno.h>
 
 #include "superblocks.h"
 
@@ -413,8 +414,12 @@ static int probe_befs(blkid_probe pr, co
 	bs = (struct befs_super_block *) blkid_probe_get_buffer(pr,
 					mag->sboff - B_OS_NAME_LENGTH,
 					sizeof(struct befs_super_block));
-	if (!bs)
+	if (!bs) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 
 	if (le32_to_cpu(bs->magic1) == SUPER_BLOCK_MAGIC1
 		&& le32_to_cpu(bs->magic2) == SUPER_BLOCK_MAGIC2
@@ -429,7 +434,7 @@ static int probe_befs(blkid_probe pr, co
 		fs_le = 0;
 		version = "big-endian";
 	} else
-		return -1;
+		return 1;
 
 	ret = get_uuid(pr, bs, &volume_id, fs_le);
 
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/btrfs.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/btrfs.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/btrfs.c
@@ -9,6 +9,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdint.h>
+#include <errno.h>
 
 #include "superblocks.h"
 
@@ -64,8 +65,12 @@ static int probe_btrfs(blkid_probe pr, c
 	struct btrfs_super_block *bfs;
 
 	bfs = blkid_probe_get_sb(pr, mag, struct btrfs_super_block);
-	if (!bfs)
+	if (!bfs) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 
 	if (*bfs->label)
 		blkid_probe_set_label(pr,
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/cramfs.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/cramfs.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/cramfs.c
@@ -14,6 +14,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdint.h>
+#include <errno.h>
 
 #include "superblocks.h"
 
@@ -39,8 +40,12 @@ static int probe_cramfs(blkid_probe pr,
 	struct cramfs_super *cs;
 
 	cs = blkid_probe_get_sb(pr, mag, struct cramfs_super);
-	if (!cs)
+	if (!cs) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 
 	blkid_probe_set_label(pr, cs->name, sizeof(cs->name));
 	return 0;
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/ddf_raid.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/ddf_raid.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/ddf_raid.c
@@ -12,6 +12,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdint.h>
+#include <errno.h>
 
 #include "superblocks.h"
 
@@ -80,7 +81,7 @@ static int probe_ddf(blkid_probe pr, con
 	uint64_t off, lba;
 
 	if (pr->size < 0x30000)
-		return -1;
+		return 1;
 
 	for (i = 0; i < ARRAY_SIZE(hdrs); i++) {
 		off = ((pr->size / 0x200) - hdrs[i]) * 0x200;
@@ -88,8 +89,12 @@ static int probe_ddf(blkid_probe pr, con
 		ddf = (struct ddf_header *) blkid_probe_get_buffer(pr,
 					off,
 					sizeof(struct ddf_header));
-		if (!ddf)
+		if (!ddf) {
+			if (errno)
 			return -1;
+			else
+				return 1;
+		}
 
 		if (ddf->signature == cpu_to_be32(DDF_MAGIC) ||
 		    ddf->signature == cpu_to_le32(DDF_MAGIC))
@@ -98,7 +103,7 @@ static int probe_ddf(blkid_probe pr, con
 	}
 
 	if (!ddf)
-		return -1;
+		return 1;
 
 	lba = ddf->signature == cpu_to_be32(DDF_MAGIC) ?
 			be64_to_cpu(ddf->primary_lba) :
@@ -110,8 +115,12 @@ static int probe_ddf(blkid_probe pr, con
 
 		buf = blkid_probe_get_buffer(pr,
 					lba << 9, sizeof(ddf->signature));
-		if (!buf || memcmp(buf, &ddf->signature, 4))
+		if (!buf) {
+			if (errno)
 			return -1;
+			else if (memcmp(buf, &ddf->signature, 4))
+				return 1;
+		}
 	}
 
 	blkid_probe_strncpy_uuid(pr, ddf->guid, sizeof(ddf->guid));
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/drbd.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/drbd.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/drbd.c
@@ -15,6 +15,7 @@
 #include <ctype.h>
 #include <inttypes.h>
 #include <stddef.h>
+#include <errno.h>
 
 #include "superblocks.h"
 
@@ -73,17 +74,21 @@ static int probe_drbd(blkid_probe pr, co
 
 	/* Small devices cannot be drbd (?) */
 	if (pr->size < 0x10000)
-		return -1;
+		return 1;
 
 	md = (struct md_on_disk_08 *)
 			blkid_probe_get_buffer(pr,
 					off,
 					sizeof(struct md_on_disk_08));
-	if (!md)
+	if (!md) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 
 	if (be32_to_cpu(md->magic) != DRBD_MD_MAGIC_08)
-		return -1;
+		return 1;
 
 	/*
 	 * DRBD does not have "real" uuids; the following resembles DRBD's
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/exfat.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/exfat.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/exfat.c
@@ -4,6 +4,7 @@
  * This file may be redistributed under the terms of the
  * GNU Lesser General Public License.
  */
+#include <errno.h>
 #include "superblocks.h"
 
 struct exfat_super_block {
@@ -114,8 +115,12 @@ static int probe_exfat(blkid_probe pr, c
 	struct exfat_entry_label *label;
 
 	sb = blkid_probe_get_sb(pr, mag, struct exfat_super_block);
-	if (!sb)
+	if (!sb) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 
 	label = find_label(pr, sb);
 	if (label)
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/ext.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/ext.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/ext.c
@@ -317,10 +317,14 @@ static int probe_jbd(blkid_probe pr, con
 	uint32_t fi;
 
 	es = ext_get_super(pr, NULL, &fi, NULL);
-	if (!es)
-		return -BLKID_ERR_PARAM;
+	if (!es) {
+		if (errno)
+			return -1;
+		else
+			return 1;
+	}
 	if (!(fi & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV))
-		return -BLKID_ERR_PARAM;
+		return 1;
 
 	ext_get_info(pr, 2, es);
 	return 0;
@@ -332,17 +336,21 @@ static int probe_ext2(blkid_probe pr, co
 	uint32_t fc, frc, fi;
 
 	es = ext_get_super(pr, &fc, &fi, &frc);
-	if (!es)
-		return -BLKID_ERR_PARAM;
+	if (!es) {
+		if (errno)
+			return -1;
+		else
+			return 1;
+	}
 
 	/* Distinguish between ext3 and ext2 */
 	if (fc & EXT3_FEATURE_COMPAT_HAS_JOURNAL)
-		return -BLKID_ERR_PARAM;
+		return 1;
 
 	/* Any features which ext2 doesn't understand */
 	if ((frc & EXT2_FEATURE_RO_COMPAT_UNSUPPORTED) ||
 	    (fi  & EXT2_FEATURE_INCOMPAT_UNSUPPORTED))
-		return -BLKID_ERR_PARAM;
+		return 1;
 
 	/*
 	 * If ext2 is not present, but ext4 or ext4dev are, then
@@ -351,7 +359,7 @@ static int probe_ext2(blkid_probe pr, co
 	if (!system_supports_ext2() &&
 	    (system_supports_ext4() || system_supports_ext4dev()) &&
 	    get_linux_version() >= EXT4_SUPPORTS_EXT2)
-		return -BLKID_ERR_PARAM;
+		return 1;
 
 	ext_get_info(pr, 2, es);
 	return 0;
@@ -363,17 +371,21 @@ static int probe_ext3(blkid_probe pr, co
 	uint32_t fc, frc, fi;
 
 	es = ext_get_super(pr, &fc, &fi, &frc);
-	if (!es)
-		return -BLKID_ERR_PARAM;
+	if (!es) {
+		if (errno)
+			return -1;
+		else
+			return 1;
+	}
 
 	/* ext3 requires journal */
 	if (!(fc & EXT3_FEATURE_COMPAT_HAS_JOURNAL))
-		return -BLKID_ERR_PARAM;
+		return 1;
 
 	/* Any features which ext3 doesn't understand */
 	if ((frc & EXT3_FEATURE_RO_COMPAT_UNSUPPORTED) ||
 	    (fi  & EXT3_FEATURE_INCOMPAT_UNSUPPORTED))
-		return -BLKID_ERR_PARAM;
+		return 1;
 
 	ext_get_info(pr, 3, es);
 	return 0;
@@ -386,12 +398,16 @@ static int probe_ext4dev(blkid_probe pr,
 	uint32_t fc, frc, fi;
 
 	es = ext_get_super(pr, &fc, &fi, &frc);
-	if (!es)
-		return -BLKID_ERR_PARAM;
+	if (!es) {
+		if (errno)
+			return -1;
+		else
+			return 1;
+	}
 
 	/* Distinguish from jbd */
 	if (fi & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV)
-		return -BLKID_ERR_PARAM;
+		return 1;
 
 	/*
 	 * If the filesystem does not have a journal and ext2 and ext4
@@ -416,9 +432,9 @@ static int probe_ext4dev(blkid_probe pr,
 	 */
 	if (le32_to_cpu(es->s_flags) & EXT2_FLAGS_TEST_FILESYS) {
 		if (!system_supports_ext4dev() && system_supports_ext4())
-			return -BLKID_ERR_PARAM;
+			return 1;
 	} else
-		return -BLKID_ERR_PARAM;
+		return 1;
 
 force_ext4dev:
 	ext_get_info(pr, 4, es);
@@ -431,12 +447,16 @@ static int probe_ext4(blkid_probe pr, co
 	uint32_t fc, frc, fi;
 
 	es = ext_get_super(pr, &fc, &fi, &frc);
-	if (!es)
+	if (!es) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 
 	/* Distinguish from jbd */
 	if (fi & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV)
-		return -BLKID_ERR_PARAM;
+		return 1;
 
 	/*
 	 * If the filesystem does not have a journal and ext2 is not
@@ -451,7 +471,7 @@ static int probe_ext4(blkid_probe pr, co
 	/* Ext4 has at least one feature which ext3 doesn't understand */
 	if (!(frc & EXT3_FEATURE_RO_COMPAT_UNSUPPORTED) &&
 	    !(fi  & EXT3_FEATURE_INCOMPAT_UNSUPPORTED))
-		return -BLKID_ERR_PARAM;
+		return 1;
 
 force_ext4:
 	/*
@@ -466,7 +486,7 @@ force_ext4:
 	 */
 	if (le32_to_cpu(es->s_flags) & EXT2_FLAGS_TEST_FILESYS) {
 		if (system_supports_ext4dev() || !system_supports_ext4())
-			return -BLKID_ERR_PARAM;
+			return 1;
 	}
 
 	ext_get_info(pr, 4, es);
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/gfs.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/gfs.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/gfs.c
@@ -9,6 +9,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdint.h>
+#include <errno.h>
 
 #include "superblocks.h"
 
@@ -63,8 +64,12 @@ static int probe_gfs(blkid_probe pr, con
 	struct gfs2_sb *sbd;
 
 	sbd = blkid_probe_get_sb(pr, mag, struct gfs2_sb);
-	if (!sbd)
+	if (!sbd) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 
 	if (be32_to_cpu(sbd->sb_fs_format) == GFS_FORMAT_FS &&
 	    be32_to_cpu(sbd->sb_multihost_format) == GFS_FORMAT_MULTI)
@@ -78,7 +83,7 @@ static int probe_gfs(blkid_probe pr, con
 		return 0;
 	}
 
-	return -1;
+	return 1;
 }
 
 static int probe_gfs2(blkid_probe pr, const struct blkid_idmag *mag)
@@ -86,8 +91,12 @@ static int probe_gfs2(blkid_probe pr, co
 	struct gfs2_sb *sbd;
 
 	sbd = blkid_probe_get_sb(pr, mag, struct gfs2_sb);
-	if (!sbd)
+	if (!sbd) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 
 	if (be32_to_cpu(sbd->sb_fs_format) == GFS2_FORMAT_FS &&
 	    be32_to_cpu(sbd->sb_multihost_format) == GFS2_FORMAT_MULTI)
@@ -100,7 +109,7 @@ static int probe_gfs2(blkid_probe pr, co
 		blkid_probe_set_version(pr, "1");
 		return 0;
 	}
-	return -1;
+	return 1;
 }
 
 const struct blkid_idinfo gfs_idinfo =
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/hfs.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/hfs.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/hfs.c
@@ -10,6 +10,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <inttypes.h>
+#include <errno.h>
 
 #include "superblocks.h"
 #include "md5.h"
@@ -151,8 +152,12 @@ static int probe_hfs(blkid_probe pr, con
 	struct hfs_mdb	*hfs;
 
 	hfs = blkid_probe_get_sb(pr, mag, struct hfs_mdb);
-	if (!hfs)
+	if (!hfs) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 
 	if ((memcmp(hfs->embed_sig, "H+", 2) == 0) ||
 	    (memcmp(hfs->embed_sig, "HX", 2) == 0))
@@ -190,8 +195,12 @@ static int probe_hfsplus(blkid_probe pr,
 	unsigned char *buf;
 
 	sbd = blkid_probe_get_sb(pr, mag, struct hfs_mdb);
-	if (!sbd)
+	if (!sbd) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 
 	/* Check for a HFS+ volume embedded in a HFS volume */
 	if (memcmp(sbd->signature, "BD", 2) == 0) {
@@ -215,8 +224,12 @@ static int probe_hfsplus(blkid_probe pr,
 		hfsplus = blkid_probe_get_sb(pr, mag,
 				struct hfsplus_vol_header);
 
-	if (!hfsplus)
+	if (!hfsplus) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 
 	if ((memcmp(hfsplus->signature, "H+", 2) != 0) &&
 	    (memcmp(hfsplus->signature, "HX", 2) != 0))
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/highpoint_raid.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/highpoint_raid.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/highpoint_raid.c
@@ -12,6 +12,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdint.h>
+#include <errno.h>
 
 #include "superblocks.h"
 
@@ -29,20 +30,24 @@ static int probe_highpoint45x(blkid_prob
 	uint32_t magic;
 
 	if (pr->size < 0x10000)
-		return -1;
+		return 1;
 	if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
-		return -1;
+		return 1;
 
 	off = ((pr->size / 0x200) - 11) * 0x200;
 	hpt = (struct hpt45x_metadata *)
 			blkid_probe_get_buffer(pr,
 					off,
 					sizeof(struct hpt45x_metadata));
-	if (!hpt)
+	if (!hpt) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 	magic = le32_to_cpu(hpt->magic);
 	if (magic != HPT45X_MAGIC_OK && magic != HPT45X_MAGIC_BAD)
-		return -1;
+		return 1;
 	if (blkid_probe_set_magic(pr, off, sizeof(hpt->magic),
 				(unsigned char *) &hpt->magic))
 		return -1;
@@ -52,7 +57,7 @@ static int probe_highpoint45x(blkid_prob
 static int probe_highpoint37x(blkid_probe pr, const struct blkid_idmag *mag)
 {
 	if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
-		return -1;
+		return 1;
 	return 0;
 }
 
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/hpfs.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/hpfs.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/hpfs.c
@@ -12,6 +12,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdint.h>
+#include <errno.h>
 
 #include "superblocks.h"
 
@@ -67,8 +68,13 @@ static int probe_hpfs(blkid_probe pr, co
 
 	/* super block */
 	hs = blkid_probe_get_sb(pr, mag, struct hpfs_super_block);
-	if (!hs)
+	if (!hs) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
+
 	version = hs->version;
 
 	/* spare super block */
@@ -76,18 +82,26 @@ static int probe_hpfs(blkid_probe pr, co
 			blkid_probe_get_buffer(pr,
 				HPFS_SBSPARE_OFFSET,
 				sizeof(struct hpfs_spare_super));
-	if (!hss)
+	if (!hss) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 	if (memcmp(hss->magic, "\x49\x18\x91\xf9", 4) != 0)
-		return -1;
+		return 1;
 
 	/* boot block (with UUID and LABEL) */
 	hbb = (struct hpfs_boot_block *)
 			blkid_probe_get_buffer(pr,
 				0,
 				sizeof(struct hpfs_boot_block));
-	if (!hbb)
+	if (!hbb) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 	if (memcmp(hbb->magic, "\x55\xaa", 2) == 0 &&
 	    memcmp(hbb->sig_hpfs, "HPFS", 4) == 0 &&
 	    hbb->sig_28h == 0x28) {
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/isw_raid.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/isw_raid.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/isw_raid.c
@@ -12,6 +12,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdint.h>
+#include <errno.h>
 
 #include "superblocks.h"
 
@@ -32,19 +33,24 @@ static int probe_iswraid(blkid_probe pr,
 	struct isw_metadata *isw;
 
 	if (pr->size < 0x10000)
-		return -1;
+		return 1;
 	if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
-		return -1;
+		return 1;
 
 	off = ((pr->size / 0x200) - 2) * 0x200;
 	isw = (struct isw_metadata *)
 			blkid_probe_get_buffer(pr,
 					off,
 					sizeof(struct isw_metadata));
-	if (!isw)
+	if (!isw) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
+
 	if (memcmp(isw->sig, ISW_SIGNATURE, sizeof(ISW_SIGNATURE)-1) != 0)
-		return -1;
+		return 1;
 	if (blkid_probe_sprintf_version(pr, "%6s",
 			&isw->sig[sizeof(ISW_SIGNATURE)-1]) != 0)
 		return -1;
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/jfs.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/jfs.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/jfs.c
@@ -39,8 +39,12 @@ static int probe_jfs(blkid_probe pr, con
 	struct jfs_super_block *js;
 
 	js = blkid_probe_get_sb(pr, mag, struct jfs_super_block);
-	if (!js)
+	if (!js) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 	if (le32_to_cpu(js->js_bsize) != (1 << le16_to_cpu(js->js_l2bsize)))
 		return 1;
 	if (le32_to_cpu(js->js_pbsize) != (1 << le16_to_cpu(js->js_l2pbsize)))
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/jmicron_raid.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/jmicron_raid.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/jmicron_raid.c
@@ -13,6 +13,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdint.h>
+#include <errno.h>
 
 #include "superblocks.h"
 
@@ -31,19 +32,23 @@ static int probe_jmraid(blkid_probe pr,
 	struct jm_metadata *jm;
 
 	if (pr->size < 0x10000)
-		return -1;
+		return 1;
 	if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
-		return -1;
+		return 1;
 
 	off = ((pr->size / 0x200) - 1) * 0x200;
 	jm = (struct jm_metadata *)
 		blkid_probe_get_buffer(pr,
 				off,
 				sizeof(struct jm_metadata));
-	if (!jm)
+	if (!jm) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 	if (memcmp(jm->signature, JM_SIGNATURE, sizeof(JM_SIGNATURE) - 1) != 0)
-		return -1;
+		return 1;
 	if (blkid_probe_sprintf_version(pr, "%u.%u",
 				jm->major_version, jm->minor_version) != 0)
 		return -1;
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/lsi_raid.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/lsi_raid.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/lsi_raid.c
@@ -13,6 +13,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdint.h>
+#include <errno.h>
 
 #include "superblocks.h"
 
@@ -29,20 +30,24 @@ static int probe_lsiraid(blkid_probe pr,
 	struct lsi_metadata *lsi;
 
 	if (pr->size < 0x10000)
-		return -1;
+		return 1;
 	if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
-		return -1;
+		return 1;
 
 	off = ((pr->size / 0x200) - 1) * 0x200;
 	lsi = (struct lsi_metadata *)
 		blkid_probe_get_buffer(pr,
 				off,
 				sizeof(struct lsi_metadata));
-	if (!lsi)
+	if (!lsi) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 
 	if (memcmp(lsi->sig, LSI_SIGNATURE, sizeof(LSI_SIGNATURE)-1) != 0)
-		return -1;
+		return 1;
 	if (blkid_probe_set_magic(pr, off, sizeof(lsi->sig),
 				(unsigned char *) lsi->sig))
 		return -1;
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/luks.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/luks.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/luks.c
@@ -44,8 +44,12 @@ static int probe_luks(blkid_probe pr, co
 	struct luks_phdr *header;
 
 	header = blkid_probe_get_sb(pr, mag, struct luks_phdr);
-	if (header == NULL)
+	if (header == NULL) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 
 	blkid_probe_strncpy_uuid(pr, (unsigned char *) header->uuid,
 			sizeof(header->uuid));
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/lvm.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/lvm.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/lvm.c
@@ -13,6 +13,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdint.h>
+#include <errno.h>
 
 #include "superblocks.h"
 
@@ -80,8 +81,12 @@ static int probe_lvm2(blkid_probe pr, co
 	buf = blkid_probe_get_buffer(pr,
 			mag->kboff << 10,
 			512 + sizeof(struct lvm2_pv_label_header));
-	if (!buf)
+	if (!buf) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 
 	/* buf is at 0k or 1k offset; find label inside */
 	if (memcmp(buf, "LABELONE", 8) == 0) {
@@ -128,8 +133,12 @@ static int probe_lvm1(blkid_probe pr, co
 	unsigned int version;
 
 	label = blkid_probe_get_sb(pr, mag, struct lvm1_pv_label_header);
-	if (!label)
+	if (!label) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 
 	version = le16_to_cpu(label->version);
 	if (version != 1 && version != 2)
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/minix.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/minix.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/minix.c
@@ -10,6 +10,7 @@
  */
 
 #include <string.h>
+#include <errno.h>
 #include "superblocks.h"
 
 struct minix_super_block {
@@ -70,23 +71,35 @@ static int probe_minix(blkid_probe pr, c
 		uint32_t zones;
 
 		sb = blkid_probe_get_sb(pr, mag, struct minix_super_block);
-		if (!sb || sb->s_imap_blocks == 0 || sb->s_zmap_blocks == 0)
+		if (!sb) {
+			if (errno)
 			return -1;
+			else
+				return 1;
+		}
+		if (sb->s_imap_blocks == 0 || sb->s_zmap_blocks == 0)
+			return 1;
 
 		zones = version == 2 ? sb->s_zones : sb->s_nzones;
 
 		/* sanity checks to be sure that the FS is really minix */
 		if (sb->s_imap_blocks * MINIX_BLOCK_SIZE * 8 < sb->s_ninodes + 1)
-			return -1;
+			return 1;
 		if (sb->s_zmap_blocks * MINIX_BLOCK_SIZE * 8 < zones - sb->s_firstdatazone + 1)
-			return -1;
+			return 1;
 
 	} else if (version == 3) {
 		struct minix3_super_block *sb;
 
 		sb = blkid_probe_get_sb(pr, mag, struct minix3_super_block);
-		if (!sb || sb->s_imap_blocks == 0 || sb->s_zmap_blocks == 0)
+		if (!sb) {
+			if (errno)
 			return -1;
+			else
+				return 1;
+		}
+		if (sb->s_imap_blocks == 0 || sb->s_zmap_blocks == 0)
+			return 1;
 
 	}
 
@@ -95,8 +108,10 @@ static int probe_minix(blkid_probe pr, c
 	 * string. (For extN magic string and offsets see ext.c.)
 	 */
 	ext = blkid_probe_get_buffer(pr, 0x400 + 0x38, 2);
-	if (ext && memcmp(ext, "\123\357", 2) == 0)
+	if (!ext && errno)
 		return -1;
+	if (ext && memcmp(ext, "\123\357", 2) == 0)
+		return 1;
 
 	blkid_probe_sprintf_version(pr, "%d", version);
 	return 0;
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/netware.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/netware.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/netware.c
@@ -12,6 +12,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdint.h>
+#include <errno.h>
 
 #include "superblocks.h"
 
@@ -70,8 +71,12 @@ static int probe_netware(blkid_probe pr,
 	struct netware_super_block *nw;
 
 	nw = blkid_probe_get_sb(pr, mag, struct netware_super_block);
-	if (!nw)
+	if (!nw) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 
 	blkid_probe_set_uuid(pr, nw->SBH_PoolID);
 
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/nilfs.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/nilfs.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/nilfs.c
@@ -6,6 +6,7 @@
  */
 #include <stddef.h>
 #include <string.h>
+#include <errno.h>
 
 #include "superblocks.h"
 #include "crc32.h"
@@ -81,8 +82,12 @@ static int probe_nilfs2(blkid_probe pr,
 	uint32_t crc;
 
 	sb = blkid_probe_get_sb(pr, mag, struct nilfs_super_block);
-	if (!sb)
+	if (!sb) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 
 	bytes = le16_to_cpu(sb->s_bytes);
 	crc = crc32(le32_to_cpu(sb->s_crc_seed), (unsigned char *)sb, sumoff);
@@ -90,7 +95,7 @@ static int probe_nilfs2(blkid_probe pr,
 	crc = crc32(crc, (unsigned char *)sb + sumoff + 4, bytes - sumoff - 4);
 
 	if (crc != le32_to_cpu(sb->s_sum))
-		return -1;
+		return 1;
 
 	if (strlen(sb->s_volume_name))
 		blkid_probe_set_label(pr, (unsigned char *) sb->s_volume_name,
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/ntfs.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/ntfs.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/ntfs.c
@@ -10,6 +10,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <inttypes.h>
+#include <errno.h>
 
 #include "superblocks.h"
 
@@ -74,8 +75,12 @@ static int probe_ntfs(blkid_probe pr, co
 	unsigned char *buf_mft, *val;
 
 	ns = blkid_probe_get_sb(pr, mag, struct ntfs_super_block);
-	if (!ns)
+	if (!ns) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 
 	bytes_per_sector = ns->bios_parameter_block[0] +
 		(ns->bios_parameter_block[1]  << 8);
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/nvidia_raid.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/nvidia_raid.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/nvidia_raid.c
@@ -13,6 +13,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdint.h>
+#include <errno.h>
 
 #include "superblocks.h"
 
@@ -31,20 +32,24 @@ static int probe_nvraid(blkid_probe pr,
 	struct nv_metadata *nv;
 
 	if (pr->size < 0x10000)
-		return -1;
+		return 1;
 	if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
-		return -1;
+		return 1;
 
 	off = ((pr->size / 0x200) - 2) * 0x200;
 	nv = (struct nv_metadata *)
 		blkid_probe_get_buffer(pr,
 				off,
 				sizeof(struct nv_metadata));
-	if (!nv)
+	if (!nv) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 
 	if (memcmp(nv->vendor, NVIDIA_SIGNATURE, sizeof(NVIDIA_SIGNATURE)-1) != 0)
-		return -1;
+		return 1;
 	if (blkid_probe_sprintf_version(pr, "%u", le16_to_cpu(nv->version)) != 0)
 		return -1;
 	if (blkid_probe_set_magic(pr, off, sizeof(nv->vendor),
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/ocfs.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/ocfs.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/ocfs.c
@@ -11,6 +11,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdint.h>
+#include <errno.h>
 
 #include "superblocks.h"
 
@@ -108,15 +109,25 @@ static int probe_ocfs(blkid_probe pr, co
 	/* header */
 	buf = blkid_probe_get_buffer(pr, mag->kboff << 10,
 			sizeof(struct ocfs_volume_header));
-	if (!buf)
+	if (!buf) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
+
 	memcpy(&ovh, buf, sizeof(ovh));
 
 	/* label */
 	buf = blkid_probe_get_buffer(pr, (mag->kboff << 10) + 512,
 			sizeof(struct ocfs_volume_label));
-	if (!buf)
+	if (!buf) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
+
 	memcpy(&ovl, buf, sizeof(ovl));
 
 	maj = ocfsmajor(ovh);
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/promise_raid.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/promise_raid.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/promise_raid.c
@@ -32,9 +32,9 @@ static int probe_pdcraid(blkid_probe pr,
 	};
 
 	if (pr->size < 0x40000)
-		return -1;
+		return 1;
 	if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
-		return -1;
+		return 1;
 
 	for (i = 0; sectors[i] != 0; i++) {
 		uint64_t off;
@@ -45,8 +45,12 @@ static int probe_pdcraid(blkid_probe pr,
 				blkid_probe_get_buffer(pr,
 					off,
 					sizeof(struct promise_metadata));
-		if (!pdc)
+		if (!pdc) {
+			if (errno)
 			return -1;
+			else
+				return 1;
+		}
 
 		if (memcmp(pdc->sig, PDC_SIGNATURE,
 				sizeof(PDC_SIGNATURE) - 1) == 0) {
@@ -57,7 +61,7 @@ static int probe_pdcraid(blkid_probe pr,
 			return 0;
 		}
 	}
-	return -1;
+	return 1;
 }
 
 const struct blkid_idinfo pdcraid_idinfo = {
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/reiserfs.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/reiserfs.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/reiserfs.c
@@ -11,6 +11,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdint.h>
+#include <errno.h>
 
 #include "superblocks.h"
 
@@ -44,8 +45,12 @@ static int probe_reiser(blkid_probe pr,
 	unsigned int blocksize;
 
 	rs = blkid_probe_get_sb(pr, mag, struct reiserfs_super_block);
-	if (!rs)
+	if (!rs) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 
 	blocksize = le16_to_cpu(rs->rs_blocksize);
 
@@ -81,8 +86,12 @@ static int probe_reiser4(blkid_probe pr,
 	struct reiser4_super_block *rs4;
 
 	rs4 = blkid_probe_get_sb(pr, mag, struct reiser4_super_block);
-	if (!rs4)
+	if (!rs4) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 
 	if (*rs4->rs4_label)
 		blkid_probe_set_label(pr, rs4->rs4_label, sizeof(rs4->rs4_label));
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/romfs.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/romfs.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/romfs.c
@@ -28,8 +28,12 @@ static int probe_romfs(blkid_probe pr, c
 	struct romfs_super_block *ros;
 
 	ros = blkid_probe_get_sb(pr, mag, struct romfs_super_block);
-	if (!ros)
+	if (!ros) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 
 	if (strlen((char *) ros->ros_volume))
 		blkid_probe_set_label(pr, ros->ros_volume,
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/silicon_raid.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/silicon_raid.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/silicon_raid.c
@@ -16,6 +16,7 @@
 #include <ctype.h>
 #include <stdint.h>
 #include <stddef.h>
+#include <errno.h>
 
 #include "superblocks.h"
 
@@ -47,20 +48,24 @@ static int probe_silraid(blkid_probe pr,
 	struct silicon_metadata *sil;
 
 	if (pr->size < 0x10000)
-		return -1;
+		return 1;
 	if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
-		return -1;
+		return 1;
 
 	off = ((pr->size / 0x200) - 1) * 0x200;
 
 	sil = (struct silicon_metadata *)
 			blkid_probe_get_buffer(pr, off,
 				sizeof(struct silicon_metadata));
-	if (!sil)
+	if (!sil) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 
 	if (le32_to_cpu(sil->magic) != SILICON_MAGIC)
-		return -1;
+		return 1;
 
 	if (blkid_probe_sprintf_version(pr, "%u.%u",
 				le16_to_cpu(sil->major_ver),
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/squashfs.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/squashfs.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/squashfs.c
@@ -12,6 +12,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdint.h>
+#include <errno.h>
 
 #include "bitops.h"	/* swab16() */
 #include "superblocks.h"
@@ -35,13 +36,17 @@ static int probe_squashfs(blkid_probe pr
 	uint16_t minor;
 
 	sq = blkid_probe_get_sb(pr, mag, struct sqsh_super_block);
-	if (!sq)
+	if (!sq) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 
 	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);
 
@@ -55,8 +60,12 @@ static int probe_squashfs3(blkid_probe p
 	uint16_t minor;
 
 	sq = blkid_probe_get_sb(pr, mag, struct sqsh_super_block);
-	if (!sq)
+	if (!sq) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 
 	if (strcmp(mag->magic, "sqsh") == 0) {
 		major = be16_to_cpu(sq->s_major);
@@ -67,7 +76,7 @@ static int probe_squashfs3(blkid_probe p
 	}
 
 	if (major > 3)
-		return -1;
+		return 1;
 
 	blkid_probe_sprintf_version(pr, "%u.%u", major, minor);
 
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/swap.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/swap.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/swap.c
@@ -73,8 +73,12 @@ static int probe_swap(blkid_probe pr, co
 
 	/* TuxOnIce keeps valid swap header at the end of the 1st page */
 	buf = blkid_probe_get_buffer(pr, 0, TOI_MAGIC_STRLEN);
-	if (!buf)
+	if (!buf) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 
 	if (memcmp(buf, TOI_MAGIC_STRING, TOI_MAGIC_STRLEN) == 0)
 		return 1;	/* Ignore swap signature, it's TuxOnIce */
@@ -87,7 +91,7 @@ static int probe_swap(blkid_probe pr, co
 	} else if (!memcmp(mag->magic, "SWAPSPACE2", mag->len))
 		return swap_set_info(pr, "2");
 
-	return -1;
+	return 1;
 }
 
 static int probe_swsuspend(blkid_probe pr, const struct blkid_idmag *mag)
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/sysv.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/sysv.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/sysv.c
@@ -13,6 +13,7 @@
 #include <unistd.h>
 #include <stdint.h>
 #include <stddef.h>
+#include <errno.h>
 
 #include "superblocks.h"
 
@@ -79,8 +80,12 @@ static int probe_xenix(blkid_probe pr, c
 	struct xenix_super_block *sb;
 
 	sb = blkid_probe_get_sb(pr, mag, struct xenix_super_block);
-	if (!sb)
+	if (!sb) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 	blkid_probe_set_label(pr, sb->s_fname, sizeof(sb->s_fname));
 	return 0;
 }
@@ -103,8 +108,12 @@ static int probe_sysv(blkid_probe pr, co
 			blkid_probe_get_buffer(pr,
 					off,
 					sizeof(struct sysv_super_block));
-		if (!sb)
+		if (!sb) {
+			if (errno)
 			return -1;
+			else
+				return 1;
+		}
 
 		if (sb->s_magic == cpu_to_le32(0xfd187e20) ||
 		    sb->s_magic == cpu_to_be32(0xfd187e20)) {
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/ubifs.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/ubifs.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/ubifs.c
@@ -9,6 +9,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdint.h>
+#include <errno.h>
 
 #include "superblocks.h"
 
@@ -99,8 +100,12 @@ static int probe_ubifs(blkid_probe pr, c
 	struct ubifs_sb_node *sb;
 
 	sb = blkid_probe_get_sb(pr, mag, struct ubifs_sb_node);
-	if (!sb)
+	if (!sb) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 
 	blkid_probe_set_uuid(pr, sb->uuid);
 	blkid_probe_sprintf_version(pr, "w%dr%d",
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/udf.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/udf.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/udf.c
@@ -74,12 +74,16 @@ static int probe_udf(blkid_probe pr, con
 			blkid_probe_get_buffer(pr,
 					UDF_VSD_OFFSET + bs,
 					sizeof(*vsd));
-		if (!vsd)
+		if (!vsd) {
+			if (errno)
+				return -1;
+			else
 			return 1;
+		}
 		if (vsd->id[0] != '\0')
 			goto nsr;
 	}
-	return -1;
+	return 1;
 
 nsr:
 	/* search the list of VSDs for a NSR descriptor */
@@ -88,23 +92,31 @@ nsr:
 			blkid_probe_get_buffer(pr,
 					UDF_VSD_OFFSET + ((blkid_loff_t) b * bs),
 					sizeof(*vsd));
-		if (!vsd)
+		if (!vsd) {
+			if (errno)
 			return -1;
+			else
+				return 1;
+		}
 		if (vsd->id[0] == '\0')
-			return -1;
+			return 1;
 		if (memcmp(vsd->id, "NSR02", 5) == 0)
 			goto anchor;
 		if (memcmp(vsd->id, "NSR03", 5) == 0)
 			goto anchor;
 	}
-	return -1;
+	return 1;
 
 anchor:
 	/* read Anchor Volume Descriptor (AVDP) */
 	vd = (struct volume_descriptor *)
 		blkid_probe_get_buffer(pr, 256 * bs, sizeof(*vd));
-	if (!vd)
+	if (!vd) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 
 	type = le16_to_cpu(vd->tag.id);
 	if (type != 2) /* TAG_ID_AVDP */
@@ -120,8 +132,12 @@ anchor:
 			blkid_probe_get_buffer(pr,
 					(blkid_loff_t) (loc + b) * bs,
 					sizeof(*vd));
-		if (!vd)
+		if (!vd) {
+			if (errno)
 			return -1;
+			else
+				return 1;
+		}
 
 		type = le16_to_cpu(vd->tag.id);
 		if (type == 0)
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/ufs.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/ufs.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/ufs.c
@@ -182,8 +182,12 @@ static int probe_ufs(blkid_probe pr, con
 				blkid_probe_get_buffer(pr,
 					offsets[i] * 1024,
 					sizeof(struct ufs_super_block));
-		if (!ufs)
+		if (!ufs) {
+			if (errno)
 			return -1;
+			else
+				return 1;
+		}
 
 		magBE = be32_to_cpu(ufs->fs_magic);
 		magLE = le32_to_cpu(ufs->fs_magic);
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/vfat.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/vfat.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/vfat.c
@@ -284,11 +284,19 @@ static int probe_vfat(blkid_probe pr, co
 	const char *version = NULL;
 
 	ms = blkid_probe_get_sb(pr, mag, struct msdos_super_block);
-	if (!ms)
-		return 0;
+	if (!ms) {
+		if (errno)
+			return -1;
+		else
+			return 1;
+	}
 	vs = blkid_probe_get_sb(pr, mag, struct vfat_super_block);
-	if (!vs)
-		return 0;
+	if (!vs) {
+		if (errno)
+			return -1;
+		else
+			return 1;
+	}
 	if (!fat_valid_superblock(mag, ms, vs, &cluster_count, &fat_size))
 		return 1;
 
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/via_raid.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/via_raid.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/via_raid.c
@@ -51,9 +51,9 @@ static int probe_viaraid(blkid_probe pr,
 	struct via_metadata *v;
 
 	if (pr->size < 0x10000)
-		return -1;
+		return 1;
 	if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
-		return -1;
+		return 1;
 
 	off = ((pr->size / 0x200)-1) * 0x200;
 
@@ -61,14 +61,19 @@ static int probe_viaraid(blkid_probe pr,
 			blkid_probe_get_buffer(pr,
 				off,
 				sizeof(struct via_metadata));
-	if (!v)
+	if (!v) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
+
 	if (le16_to_cpu(v->signature) != VIA_SIGNATURE)
-		return -1;
+		return 1;
 	if (v->version_number > 2)
-		return -1;
+		return 1;
 	if (!via_checksum(v))
-		return -1;
+		return 1;
 	if (blkid_probe_sprintf_version(pr, "%u", v->version_number) != 0)
 		return -1;
 	if (blkid_probe_set_magic(pr, off,
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/vmfs.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/vmfs.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/vmfs.c
@@ -4,6 +4,7 @@
  * This file may be redistributed under the terms of the
  * GNU Lesser General Public License.
  */
+#include <errno.h>
 #include "superblocks.h"
 
 struct vmfs_fs_info {
@@ -27,8 +28,12 @@ static int probe_vmfs_fs(blkid_probe pr,
 	struct vmfs_fs_info *header;
 
 	header = blkid_probe_get_sb(pr, mag, struct vmfs_fs_info);
-	if (header == NULL)
+	if (header == NULL) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 
 	blkid_probe_sprintf_uuid(pr, (unsigned char *) header->uuid, 16,
 		"%02x%02x%02x%02x-%02x%02x%02x%02x-"
@@ -52,8 +57,12 @@ static int probe_vmfs_volume(blkid_probe
 	unsigned char *lvm_uuid;
 
 	header = blkid_probe_get_sb(pr, mag, struct vmfs_volume_info);
-	if (header == NULL)
+	if (header == NULL) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 
 	blkid_probe_sprintf_value(pr, "UUID_SUB",
 		"%02x%02x%02x%02x-%02x%02x%02x%02x-"
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/vxfs.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/vxfs.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/vxfs.c
@@ -6,6 +6,7 @@
  */
 
 #include <stdio.h>
+#include <errno.h>
 
 #include "superblocks.h"
 
@@ -19,8 +20,12 @@ static int probe_vxfs(blkid_probe pr, co
 	struct vxfs_super_block *vxs;
 
 	vxs = blkid_probe_get_sb(pr, mag, struct vxfs_super_block);
-	if (!vxs)
+	if (!vxs) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 
 	blkid_probe_sprintf_version(pr, "%u", (unsigned int) vxs->vs_version);
 	return 0;
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/xfs.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/xfs.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/xfs.c
@@ -39,8 +39,12 @@ static int probe_xfs(blkid_probe pr, con
 	struct xfs_super_block *xs;
 
 	xs = blkid_probe_get_sb(pr, mag, struct xfs_super_block);
-	if (!xs)
+	if (!xs) {
+		if (errno)
 		return -1;
+		else
+			return 1;
+	}
 
 	if (strlen(xs->xs_fname))
 		blkid_probe_set_label(pr, (unsigned char *) xs->xs_fname,
Index: util-linux-2.19.1/shlibs/blkid/src/superblocks/zfs.c
===================================================================
--- util-linux-2.19.1.orig/shlibs/blkid/src/superblocks/zfs.c
+++ util-linux-2.19.1/shlibs/blkid/src/superblocks/zfs.c
@@ -180,8 +180,12 @@ static int probe_zfs(blkid_probe pr, con
 		ub = (struct zfs_uberblock *)
 			blkid_probe_get_buffer(pr, offset,
 					       sizeof(struct zfs_uberblock));
-		if (ub == NULL)
+		if (ub == NULL) {
+			if (errno)
 			return -1;
+			else
+				return 1;
+		}
 
 		if (ub->ub_magic == UBERBLOCK_MAGIC)
 			found++;
@@ -194,7 +198,7 @@ static int probe_zfs(blkid_probe pr, con
 	}
 
 	if (found < 4)
-		return -1;
+		return 1;
 
 	/* If we found the 4th uberblock, then we will have exited from the
 	 * scanning loop immediately, and ub will be a valid uberblock. */
