dcavalca / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone
6717ab
diff -up util-linux-2.23.2/libblkid/src/blkidP.h.kzak util-linux-2.23.2/libblkid/src/blkidP.h
6717ab
--- util-linux-2.23.2/libblkid/src/blkidP.h.kzak	2014-03-28 15:11:18.334283704 +0100
6717ab
+++ util-linux-2.23.2/libblkid/src/blkidP.h	2014-03-28 15:11:44.676551975 +0100
6717ab
@@ -297,6 +297,9 @@ struct blkid_struct_cache
6717ab
 /* old systems */
6717ab
 #define BLKID_CACHE_FILE_OLD	"/etc/blkid.tab"
6717ab
 
6717ab
+#define BLKID_PROBE_OK	 0
6717ab
+#define BLKID_PROBE_NONE 1
6717ab
+
6717ab
 #define BLKID_ERR_IO	 5
6717ab
 #define BLKID_ERR_PROC	 9
6717ab
 #define BLKID_ERR_MEM	12
6717ab
diff -up util-linux-2.23.2/libblkid/src/partitions/aix.c.kzak util-linux-2.23.2/libblkid/src/partitions/aix.c
6717ab
--- util-linux-2.23.2/libblkid/src/partitions/aix.c.kzak	2013-05-30 15:21:43.120591308 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/partitions/aix.c	2014-03-28 15:11:44.676551975 +0100
6717ab
@@ -22,19 +22,17 @@ static int probe_aix_pt(blkid_probe pr,
6717ab
 
6717ab
 	if (blkid_partitions_need_typeonly(pr))
6717ab
 		/* caller does not ask for details about partitions */
6717ab
-		return 0;
6717ab
+		return BLKID_PROBE_OK;
6717ab
 
6717ab
 	ls = blkid_probe_get_partlist(pr);
6717ab
 	if (!ls)
6717ab
-		goto err;
6717ab
+		return BLKID_PROBE_NONE;
6717ab
 
6717ab
 	tab = blkid_partlist_new_parttable(ls, "aix", 0);
6717ab
 	if (!tab)
6717ab
-		goto err;
6717ab
+		return -ENOMEM;
6717ab
 
6717ab
-	return 0;
6717ab
-err:
6717ab
-	return -1;
6717ab
+	return BLKID_PROBE_OK;
6717ab
 }
6717ab
 
6717ab
 /*
6717ab
diff -up util-linux-2.23.2/libblkid/src/partitions/bsd.c.kzak util-linux-2.23.2/libblkid/src/partitions/bsd.c
6717ab
--- util-linux-2.23.2/libblkid/src/partitions/bsd.c.kzak	2013-07-15 10:25:46.283049056 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/partitions/bsd.c	2014-03-28 15:11:44.677551986 +0100
6717ab
@@ -113,20 +113,24 @@ static int probe_bsd_pt(blkid_probe pr,
6717ab
 	blkid_partlist ls;
6717ab
 	int i, nparts = BSD_MAXPARTITIONS;
6717ab
 	unsigned char *data;
6717ab
+	int rc = BLKID_PROBE_NONE;
6717ab
 
6717ab
 	if (blkid_partitions_need_typeonly(pr))
6717ab
 		/* caller does not ask for details about partitions */
6717ab
-		return 0;
6717ab
+		return rc;
6717ab
 
6717ab
 	data = blkid_probe_get_sector(pr, BLKID_MAG_SECTOR(mag));
6717ab
-	if (!data)
6717ab
+	if (!data) {
6717ab
+		if (errno)
6717ab
+			rc = -errno;
6717ab
 		goto nothing;
6717ab
+	}
6717ab
 
6717ab
 	l = (struct bsd_disklabel *) data + BLKID_MAG_LASTOFFSET(mag);
6717ab
 
6717ab
 	ls = blkid_probe_get_partlist(pr);
6717ab
 	if (!ls)
6717ab
-		goto err;
6717ab
+		goto nothing;
6717ab
 
6717ab
 	/* try to determine the real type of BSD system according to
6717ab
 	 * (parental) primary partition */
6717ab
@@ -152,8 +156,10 @@ static int probe_bsd_pt(blkid_probe pr,
6717ab
 	}
6717ab
 
6717ab
 	tab = blkid_partlist_new_parttable(ls, name, BLKID_MAG_OFFSET(mag));
6717ab
-	if (!tab)
6717ab
-		goto err;
6717ab
+	if (!tab) {
6717ab
+		rc = -ENOMEM;
6717ab
+		goto nothing;
6717ab
+	}
6717ab
 
6717ab
 	if (le16_to_cpu(l->d_npartitions) < BSD_MAXPARTITIONS)
6717ab
 		nparts = le16_to_cpu(l->d_npartitions);
6717ab
@@ -189,18 +195,18 @@ static int probe_bsd_pt(blkid_probe pr,
6717ab
 		}
6717ab
 
6717ab
 		par = blkid_partlist_add_partition(ls, tab, start, size);
6717ab
-		if (!par)
6717ab
-			goto err;
6717ab
+		if (!par) {
6717ab
+			rc = -ENOMEM;
6717ab
+			goto nothing;
6717ab
+		}
6717ab
 
6717ab
 		blkid_partition_set_type(par, p->p_fstype);
6717ab
 	}
6717ab
 
6717ab
-	return 0;
6717ab
+	return BLKID_PROBE_OK;
6717ab
 
6717ab
 nothing:
6717ab
-	return 1;
6717ab
-err:
6717ab
-	return -1;
6717ab
+	return rc;
6717ab
 }
6717ab
 
6717ab
 
6717ab
diff -up util-linux-2.23.2/libblkid/src/partitions/dos.c.kzak util-linux-2.23.2/libblkid/src/partitions/dos.c
6717ab
--- util-linux-2.23.2/libblkid/src/partitions/dos.c.kzak	2013-07-30 10:39:26.205738229 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/partitions/dos.c	2014-03-28 15:13:23.220555797 +0100
6717ab
@@ -53,10 +53,13 @@ static int parse_dos_extended(blkid_prob
6717ab
 		uint32_t start, size;
6717ab
 
6717ab
 		if (++ct_nodata > 100)
6717ab
-			return 0;
6717ab
+			return BLKID_PROBE_OK;
6717ab
 		data = blkid_probe_get_sector(pr, cur_start);
6717ab
-		if (!data)
6717ab
+		if (!data) {
6717ab
+			if (errno)
6717ab
+				return -errno;
6717ab
 			goto leave;	/* malformed partition? */
6717ab
+		}
6717ab
 
6717ab
 		if (!is_valid_mbr_signature(data))
6717ab
 			goto leave;
6717ab
@@ -99,7 +102,7 @@ static int parse_dos_extended(blkid_prob
6717ab
 
6717ab
 			par = blkid_partlist_add_partition(ls, tab, abs_start, size);
6717ab
 			if (!par)
6717ab
-				goto err;
6717ab
+				return -ENOMEM;
6717ab
 
6717ab
 			blkid_partition_set_type(par, p->sys_type);
6717ab
 			blkid_partition_set_flags(par, p->boot_ind);
6717ab
@@ -123,9 +126,7 @@ static int parse_dos_extended(blkid_prob
6717ab
 		cur_size = size;
6717ab
 	}
6717ab
 leave:
6717ab
-	return 0;
6717ab
-err:
6717ab
-	return -1;
6717ab
+	return BLKID_PROBE_OK;
6717ab
 }
6717ab
 
6717ab
 static int probe_dos_pt(blkid_probe pr,
6717ab
@@ -140,8 +141,11 @@ static int probe_dos_pt(blkid_probe pr,
6717ab
 	uint32_t start, size, id;
6717ab
 
6717ab
 	data = blkid_probe_get_sector(pr, 0);
6717ab
-	if (!data)
6717ab
+	if (!data) {
6717ab
+		if (errno)
6717ab
+			return -errno;
6717ab
 		goto nothing;
6717ab
+	}
6717ab
 
6717ab
 	/* ignore disks with AIX magic number -- for more details see aix.c */
6717ab
 	if (memcmp(data, BLKID_AIX_MAGIC_STRING, BLKID_AIX_MAGIC_STRLEN) == 0)
6717ab
@@ -152,7 +156,7 @@ static int probe_dos_pt(blkid_probe pr,
6717ab
 	 * either the boot sector of a FAT filesystem or a DOS-type
6717ab
 	 * partition table.
6717ab
 	 */
6717ab
-	if (blkid_probe_is_vfat(pr)) {
6717ab
+	if (blkid_probe_is_vfat(pr) == 1) {
6717ab
 		DBG(LOWPROBE, blkid_debug("probably FAT -- ignore"));
6717ab
 		goto nothing;
6717ab
 	}
6717ab
@@ -189,6 +193,8 @@ static int probe_dos_pt(blkid_probe pr,
6717ab
 		return 0;
6717ab
 
6717ab
 	ls = blkid_probe_get_partlist(pr);
6717ab
+	if (!ls)
6717ab
+		goto nothing;
6717ab
 
6717ab
 	/* sector size factor (the start and size are in the real sectors, but
6717ab
 	 * we need to convert all sizes to 512 logical sectors
6717ab
@@ -198,7 +204,7 @@ static int probe_dos_pt(blkid_probe pr,
6717ab
 	/* allocate a new partition table */
6717ab
 	tab = blkid_partlist_new_parttable(ls, "dos", BLKID_MSDOS_PT_OFFSET);
6717ab
 	if (!tab)
6717ab
-		goto err;
6717ab
+		return -ENOMEM;
6717ab
 
6717ab
 	id = dos_parttable_id(data);
6717ab
 	if (id) {
6717ab
@@ -224,7 +230,7 @@ static int probe_dos_pt(blkid_probe pr,
6717ab
 		}
6717ab
 		par = blkid_partlist_add_partition(ls, tab, start, size);
6717ab
 		if (!par)
6717ab
-			goto err;
6717ab
+			return -ENOMEM;
6717ab
 
6717ab
 		blkid_partition_set_type(par, p->sys_type);
6717ab
 		blkid_partition_set_flags(par, p->boot_ind);
6717ab
@@ -244,13 +250,14 @@ static int probe_dos_pt(blkid_probe pr,
6717ab
 			continue;
6717ab
 		if (is_extended(p) &&
6717ab
 		    parse_dos_extended(pr, tab, start, size, ssf) == -1)
6717ab
-			goto err;
6717ab
+			goto nothing;
6717ab
 	}
6717ab
 
6717ab
 	/* Parse subtypes (nested partitions) on large disks */
6717ab
 	if (!blkid_probe_is_tiny(pr)) {
6717ab
 		for (p = p0, i = 0; i < 4; i++, p++) {
6717ab
 			size_t n;
6717ab
+			int rc;
6717ab
 
6717ab
 			if (!dos_partition_size(p) || is_extended(p))
6717ab
 				continue;
6717ab
@@ -259,20 +266,19 @@ static int probe_dos_pt(blkid_probe pr,
6717ab
 				if (dos_nested[n].type != p->sys_type)
6717ab
 					continue;
6717ab
 
6717ab
-				if (blkid_partitions_do_subprobe(pr,
6717ab
+				rc = blkid_partitions_do_subprobe(pr,
6717ab
 						blkid_partlist_get_partition(ls, i),
6717ab
-						dos_nested[n].id) == -1)
6717ab
-					goto err;
6717ab
+						dos_nested[n].id);
6717ab
+				if (rc < 0)
6717ab
+					return rc;
6717ab
 				break;
6717ab
 			}
6717ab
 		}
6717ab
 	}
6717ab
-	return 0;
6717ab
+	return BLKID_PROBE_OK;
6717ab
 
6717ab
 nothing:
6717ab
-	return 1;
6717ab
-err:
6717ab
-	return -1;
6717ab
+	return BLKID_PROBE_NONE;
6717ab
 }
6717ab
 
6717ab
 
6717ab
diff -up util-linux-2.23.2/libblkid/src/partitions/gpt.c.kzak util-linux-2.23.2/libblkid/src/partitions/gpt.c
6717ab
--- util-linux-2.23.2/libblkid/src/partitions/gpt.c.kzak	2014-03-28 15:11:18.336283724 +0100
6717ab
+++ util-linux-2.23.2/libblkid/src/partitions/gpt.c	2014-03-28 15:11:44.677551986 +0100
6717ab
@@ -169,8 +169,11 @@ static int is_pmbr_valid(blkid_probe pr,
6717ab
 		goto ok;			/* skip PMBR check */
6717ab
 
6717ab
 	data = blkid_probe_get_sector(pr, 0);
6717ab
-	if (!data)
6717ab
+	if (!data) {
6717ab
+		if (errno)
6717ab
+			return -errno;
6717ab
 		goto failed;
6717ab
+	}
6717ab
 
6717ab
 	if (!is_valid_mbr_signature(data))
6717ab
 		goto failed;
6717ab
@@ -305,19 +308,27 @@ static int probe_gpt_pt(blkid_probe pr,
6717ab
 	uint64_t fu, lu;
6717ab
 	uint32_t ssf, i;
6717ab
 	efi_guid_t guid;
6717ab
+	int ret;
6717ab
 
6717ab
 	if (last_lba(pr, &lastlba))
6717ab
 		goto nothing;
6717ab
 
6717ab
-	if (!is_pmbr_valid(pr, NULL))
6717ab
+	ret = is_pmbr_valid(pr, NULL);
6717ab
+	if (ret < 0)
6717ab
+		return ret;
6717ab
+	else if (ret == 0)
6717ab
 		goto nothing;
6717ab
 
6717ab
+	errno = 0;
6717ab
 	h = get_gpt_header(pr, &hdr, &e, (lba = GPT_PRIMARY_LBA), lastlba);
6717ab
-	if (!h)
6717ab
+	if (!h && !errno)
6717ab
 		h = get_gpt_header(pr, &hdr, &e, (lba = lastlba), lastlba);
6717ab
 
6717ab
-	if (!h)
6717ab
+	if (!h) {
6717ab
+		if (errno)
6717ab
+			return -errno;
6717ab
 		goto nothing;
6717ab
+	}
6717ab
 
6717ab
 	blkid_probe_use_wiper(pr, lba * blkid_probe_get_size(pr), 8);
6717ab
 
6717ab
@@ -388,12 +399,13 @@ static int probe_gpt_pt(blkid_probe pr,
6717ab
 		blkid_partition_set_flags(par, e->attributes);
6717ab
 	}
6717ab
 
6717ab
-	return 0;
6717ab
+	return BLKID_PROBE_OK;
6717ab
 
6717ab
 nothing:
6717ab
-	return 1;
6717ab
+	return BLKID_PROBE_NONE;
6717ab
+
6717ab
 err:
6717ab
-	return -1;
6717ab
+	return -ENOMEM;
6717ab
 }
6717ab
 
6717ab
 
6717ab
diff -up util-linux-2.23.2/libblkid/src/partitions/mac.c.kzak util-linux-2.23.2/libblkid/src/partitions/mac.c
6717ab
--- util-linux-2.23.2/libblkid/src/partitions/mac.c.kzak	2013-06-13 09:46:10.418650605 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/partitions/mac.c	2014-03-28 15:11:44.677551986 +0100
6717ab
@@ -87,8 +87,11 @@ static int probe_mac_pt(blkid_probe pr,
6717ab
 	 * the first block on the disk.
6717ab
 	 */
6717ab
 	md = (struct mac_driver_desc *) blkid_probe_get_sector(pr, 0);
6717ab
-	if (!md)
6717ab
+	if (!md) {
6717ab
+		if (errno)
6717ab
+			return -errno;
6717ab
 		goto nothing;
6717ab
+	}
6717ab
 
6717ab
 	block_size = be16_to_cpu(md->block_size);
6717ab
 
6717ab
@@ -96,8 +99,11 @@ static int probe_mac_pt(blkid_probe pr,
6717ab
 	 * the second block on the disk.
6717ab
 	 */
6717ab
 	p = (struct mac_partition *) get_mac_block(pr, block_size, 1);
6717ab
-	if (!p)
6717ab
+	if (!p) {
6717ab
+		if (errno)
6717ab
+			return -errno;
6717ab
 		goto nothing;
6717ab
+	}
6717ab
 
6717ab
 	/* check the first partition signature */
6717ab
 	if (!has_part_signature(p))
6717ab
@@ -109,7 +115,7 @@ static int probe_mac_pt(blkid_probe pr,
6717ab
 
6717ab
 	ls = blkid_probe_get_partlist(pr);
6717ab
 	if (!ls)
6717ab
-		goto err;
6717ab
+		goto nothing;
6717ab
 
6717ab
 	tab = blkid_partlist_new_parttable(ls, "mac", 0);
6717ab
 	if (!tab)
6717ab
@@ -124,15 +130,18 @@ static int probe_mac_pt(blkid_probe pr,
6717ab
 		uint32_t size;
6717ab
 
6717ab
 		p = (struct mac_partition *) get_mac_block(pr, block_size, i);
6717ab
-		if (!p)
6717ab
+		if (!p) {
6717ab
+			if (errno)
6717ab
+				return -errno;
6717ab
 			goto nothing;
6717ab
+		}
6717ab
 		if (!has_part_signature(p))
6717ab
 			goto nothing;
6717ab
 
6717ab
 		if (be32_to_cpu(p->map_count) != nblks) {
6717ab
 			DBG(LOWPROBE, blkid_debug(
6717ab
 				"mac: inconsisten map_count in partition map, "
6717ab
-			        "entry[0]: %d, entry[%d]: %d",
6717ab
+				"entry[0]: %d, entry[%d]: %d",
6717ab
 				nblks, i - 1,
6717ab
 				be32_to_cpu(p->map_count)));
6717ab
 		}
6717ab
@@ -157,12 +166,12 @@ static int probe_mac_pt(blkid_probe pr,
6717ab
 						sizeof(p->type));
6717ab
 	}
6717ab
 
6717ab
-	return 0;
6717ab
+	return BLKID_PROBE_OK;
6717ab
 
6717ab
 nothing:
6717ab
-	return 1;
6717ab
+	return BLKID_PROBE_NONE;
6717ab
 err:
6717ab
-	return -1;
6717ab
+	return -ENOMEM;
6717ab
 }
6717ab
 
6717ab
 /*
6717ab
diff -up util-linux-2.23.2/libblkid/src/partitions/minix.c.kzak util-linux-2.23.2/libblkid/src/partitions/minix.c
6717ab
--- util-linux-2.23.2/libblkid/src/partitions/minix.c.kzak	2013-07-15 10:25:46.284049064 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/partitions/minix.c	2014-03-28 15:36:23.866715100 +0100
6717ab
@@ -26,12 +26,15 @@ static int probe_minix_pt(blkid_probe pr
6717ab
 	int i;
6717ab
 
6717ab
 	data = blkid_probe_get_sector(pr, 0);
6717ab
-	if (!data)
6717ab
+	if (!data) {
6717ab
+		if (errno)
6717ab
+			return -errno;
6717ab
 		goto nothing;
6717ab
+	}
6717ab
 
6717ab
 	ls = blkid_probe_get_partlist(pr);
6717ab
 	if (!ls)
6717ab
-		goto err;
6717ab
+		goto nothing;
6717ab
 
6717ab
 	/* Parent is required, because Minix uses the same PT as DOS and
6717ab
 	 * difference is only in primary partition (parent) type.
6717ab
@@ -78,12 +81,12 @@ static int probe_minix_pt(blkid_probe pr
6717ab
 		blkid_partition_set_flags(par, p->boot_ind);
6717ab
 	}
6717ab
 
6717ab
-	return 0;
6717ab
+	return BLKID_PROBE_OK;
6717ab
 
6717ab
 nothing:
6717ab
-	return 1;
6717ab
+	return BLKID_PROBE_NONE;
6717ab
 err:
6717ab
-	return -1;
6717ab
+	return -ENOMEM;
6717ab
 }
6717ab
 
6717ab
 /* same as DOS */
6717ab
diff -up util-linux-2.23.2/libblkid/src/partitions/partitions.c.kzak util-linux-2.23.2/libblkid/src/partitions/partitions.c
6717ab
--- util-linux-2.23.2/libblkid/src/partitions/partitions.c.kzak	2014-03-28 15:11:18.336283724 +0100
6717ab
+++ util-linux-2.23.2/libblkid/src/partitions/partitions.c	2014-03-28 15:12:28.036993622 +0100
6717ab
@@ -533,12 +533,13 @@ static int idinfo_probe(blkid_probe pr,
6717ab
 {
6717ab
 	const struct blkid_idmag *mag = NULL;
6717ab
 	blkid_loff_t off;
6717ab
-	int rc = 1;		/* = nothing detected */
6717ab
+	int rc = BLKID_PROBE_NONE;		/* = nothing detected */
6717ab
 
6717ab
 	if (pr->size <= 0 || (id->minsz && id->minsz > pr->size))
6717ab
 		goto nothing;	/* the device is too small */
6717ab
 
6717ab
-	if (blkid_probe_get_idmag(pr, id, &off, &mag))
6717ab
+	rc = blkid_probe_get_idmag(pr, id, &off, &mag;;
6717ab
+	if (rc != BLKID_PROBE_OK)
6717ab
 		goto nothing;
6717ab
 
6717ab
 	/* final check by probing function */
6717ab
@@ -546,14 +547,15 @@ static int idinfo_probe(blkid_probe pr,
6717ab
 		DBG(LOWPROBE, blkid_debug(
6717ab
 			"%s: ---> call probefunc()", id->name));
6717ab
 		rc = id->probefunc(pr, mag);
6717ab
-	        if (rc == -1) {
6717ab
+		if (rc < 0) {
6717ab
 			/* reset after error */
6717ab
 			reset_partlist(blkid_probe_get_partlist(pr));
6717ab
 			if (chn && !chn->binary)
6717ab
 				blkid_probe_chain_reset_vals(pr, chn);
6717ab
-			DBG(LOWPROBE, blkid_debug("%s probefunc failed", id->name));
6717ab
+			DBG(LOWPROBE, blkid_debug("%s probefunc failed, rc %d",
6717ab
+						  id->name, rc));
6717ab
 		}
6717ab
-		if (rc == 0 && mag && chn && !chn->binary)
6717ab
+		if (rc == BLKID_PROBE_OK && mag && chn && !chn->binary)
6717ab
 			rc = blkid_probe_set_magic(pr, off, mag->len,
6717ab
 					(unsigned char *) mag->magic);
6717ab
 
6717ab
@@ -569,11 +571,11 @@ nothing:
6717ab
  */
6717ab
 static int partitions_probe(blkid_probe pr, struct blkid_chain *chn)
6717ab
 {
6717ab
-	int rc = 1;
6717ab
+	int rc = BLKID_PROBE_NONE;
6717ab
 	size_t i;
6717ab
 
6717ab
 	if (!pr || chn->idx < -1)
6717ab
-		return -1;
6717ab
+		return -EINVAL;
6717ab
 	blkid_probe_chain_reset_vals(pr, chn);
6717ab
 
6717ab
 	if (chn->binary)
6717ab
@@ -597,7 +599,10 @@ static int partitions_probe(blkid_probe
6717ab
 			continue;
6717ab
 
6717ab
 		/* apply checks from idinfo */
6717ab
-		if (idinfo_probe(pr, idinfos[i], chn) != 0)
6717ab
+		rc = idinfo_probe(pr, idinfos[i], chn);
6717ab
+		if (rc < 0)
6717ab
+			break;
6717ab
+		if (rc != BLKID_PROBE_OK)
6717ab
 			continue;
6717ab
 
6717ab
 		name = idinfos[i]->name;
6717ab
@@ -613,20 +618,21 @@ static int partitions_probe(blkid_probe
6717ab
 		break;
6717ab
 	}
6717ab
 
6717ab
-	if (rc == 1) {
6717ab
-		DBG(LOWPROBE, blkid_debug("<-- leaving probing loop (failed) [PARTS idx=%d]",
6717ab
-			chn->idx));
6717ab
+	if (rc != BLKID_PROBE_OK) {
6717ab
+		DBG(LOWPROBE, blkid_debug("<-- leaving probing loop (failed=%d) [PARTS idx=%d]",
6717ab
+			rc, chn->idx));
6717ab
 	}
6717ab
 
6717ab
 details_only:
6717ab
 	/*
6717ab
 	 * Gather PART_ENTRY_* values if the current device is a partition.
6717ab
 	 */
6717ab
-	if (!chn->binary &&
6717ab
+	if ((rc == BLKID_PROBE_OK || rc == BLKID_PROBE_NONE) && !chn->binary &&
6717ab
 	    (blkid_partitions_get_flags(pr) & BLKID_PARTS_ENTRY_DETAILS)) {
6717ab
 
6717ab
-		if (!blkid_partitions_probe_partition(pr))
6717ab
-			rc = 0;
6717ab
+		int xrc = blkid_partitions_probe_partition(pr);
6717ab
+		if (xrc < 0)
6717ab
+			rc = xrc;	/* optional, care about errors only */
6717ab
 	}
6717ab
 
6717ab
 	return rc;
6717ab
@@ -637,7 +643,7 @@ int blkid_partitions_do_subprobe(blkid_p
6717ab
 		const struct blkid_idinfo *id)
6717ab
 {
6717ab
 	blkid_probe prc;
6717ab
-	int rc = 1;
6717ab
+	int rc;
6717ab
 	blkid_partlist ls;
6717ab
 	blkid_loff_t sz, off;
6717ab
 
6717ab
@@ -646,7 +652,7 @@ int blkid_partitions_do_subprobe(blkid_p
6717ab
 		id->name, parent));
6717ab
 
6717ab
 	if (!pr || !parent || !parent->size)
6717ab
-		return -1;
6717ab
+		return -EINVAL;
6717ab
 
6717ab
 	/* range defined by parent */
6717ab
 	sz = ((blkid_loff_t) parent->size) << 9;
6717ab
@@ -656,13 +662,13 @@ int blkid_partitions_do_subprobe(blkid_p
6717ab
 		DBG(LOWPROBE, blkid_debug(
6717ab
 			"ERROR: parts: <---- '%s' subprobe: overflow detected.",
6717ab
 			id->name));
6717ab
-		return -1;
6717ab
+		return -ENOSPC;
6717ab
 	}
6717ab
 
6717ab
 	/* create private prober */
6717ab
 	prc = blkid_clone_probe(pr);
6717ab
 	if (!prc)
6717ab
-		return -1;
6717ab
+		return -ENOMEM;
6717ab
 
6717ab
 	blkid_probe_set_dimension(prc, off, sz);
6717ab
 
6717ab
@@ -695,7 +701,7 @@ int blkid_partitions_do_subprobe(blkid_p
6717ab
 
6717ab
 static int blkid_partitions_probe_partition(blkid_probe pr)
6717ab
 {
6717ab
-	int rc = 1;
6717ab
+	int rc = BLKID_PROBE_NONE;
6717ab
 	blkid_probe disk_pr = NULL;
6717ab
 	blkid_partlist ls;
6717ab
 	blkid_partition par;
6717ab
@@ -761,7 +767,7 @@ static int blkid_partitions_probe_partit
6717ab
 		blkid_probe_sprintf_value(pr, "PART_ENTRY_DISK", "%u:%u",
6717ab
 				major(disk), minor(disk));
6717ab
 	}
6717ab
-	rc = 0;
6717ab
+	rc = BLKID_PROBE_OK;
6717ab
 nothing:
6717ab
 	return rc;
6717ab
 }
6717ab
diff -up util-linux-2.23.2/libblkid/src/partitions/sgi.c.kzak util-linux-2.23.2/libblkid/src/partitions/sgi.c
6717ab
--- util-linux-2.23.2/libblkid/src/partitions/sgi.c.kzak	2013-07-15 10:25:46.285049072 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/partitions/sgi.c	2014-03-28 15:11:44.677551986 +0100
6717ab
@@ -99,8 +99,11 @@ static int probe_sgi_pt(blkid_probe pr,
6717ab
 	int i;
6717ab
 
6717ab
 	l = (struct sgi_disklabel *) blkid_probe_get_sector(pr, 0);
6717ab
-	if (!l)
6717ab
+	if (!l) {
6717ab
+		if (errno)
6717ab
+			return -errno;
6717ab
 		goto nothing;
6717ab
+	}
6717ab
 
6717ab
 	if (count_checksum(l)) {
6717ab
 		DBG(LOWPROBE, blkid_debug(
6717ab
@@ -110,11 +113,11 @@ static int probe_sgi_pt(blkid_probe pr,
6717ab
 
6717ab
 	if (blkid_partitions_need_typeonly(pr))
6717ab
 		/* caller does not ask for details about partitions */
6717ab
-		return 0;
6717ab
+		return BLKID_PROBE_OK;
6717ab
 
6717ab
 	ls = blkid_probe_get_partlist(pr);
6717ab
 	if (!ls)
6717ab
-		goto err;
6717ab
+		goto nothing;
6717ab
 
6717ab
 	tab = blkid_partlist_new_parttable(ls, "sgi", 0);
6717ab
 	if (!tab)
6717ab
@@ -138,12 +141,12 @@ static int probe_sgi_pt(blkid_probe pr,
6717ab
 		blkid_partition_set_type(par, type);
6717ab
 	}
6717ab
 
6717ab
-	return 0;
6717ab
+	return BLKID_PROBE_OK;
6717ab
 
6717ab
 nothing:
6717ab
-	return 1;
6717ab
+	return BLKID_PROBE_NONE;
6717ab
 err:
6717ab
-	return -1;
6717ab
+	return -ENOMEM;
6717ab
 }
6717ab
 
6717ab
 const struct blkid_idinfo sgi_pt_idinfo =
6717ab
diff -up util-linux-2.23.2/libblkid/src/partitions/solaris_x86.c.kzak util-linux-2.23.2/libblkid/src/partitions/solaris_x86.c
6717ab
--- util-linux-2.23.2/libblkid/src/partitions/solaris_x86.c.kzak	2013-06-13 09:46:10.418650605 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/partitions/solaris_x86.c	2014-03-28 15:11:44.677551986 +0100
6717ab
@@ -69,8 +69,11 @@ static int probe_solaris_pt(blkid_probe
6717ab
 	uint16_t nparts;
6717ab
 
6717ab
 	l = (struct solaris_vtoc *) blkid_probe_get_sector(pr, SOLARIS_SECTOR);
6717ab
-	if (!l)
6717ab
+	if (!l) {
6717ab
+		if (errno)
6717ab
+			return -errno;
6717ab
 		goto nothing;
6717ab
+	}
6717ab
 
6717ab
 	if (le32_to_cpu(l->v_version) != 1) {
6717ab
 		DBG(LOWPROBE, blkid_debug(
6717ab
@@ -81,11 +84,11 @@ static int probe_solaris_pt(blkid_probe
6717ab
 
6717ab
 	if (blkid_partitions_need_typeonly(pr))
6717ab
 		/* caller does not ask for details about partitions */
6717ab
-		return 0;
6717ab
+		return BLKID_PROBE_OK;
6717ab
 
6717ab
 	ls = blkid_probe_get_partlist(pr);
6717ab
 	if (!ls)
6717ab
-		goto err;
6717ab
+		goto nothing;
6717ab
 
6717ab
 	parent = blkid_partlist_get_parent(ls);
6717ab
 
6717ab
@@ -126,12 +129,12 @@ static int probe_solaris_pt(blkid_probe
6717ab
 		blkid_partition_set_flags(par, le16_to_cpu(p->s_flag));
6717ab
 	}
6717ab
 
6717ab
-	return 0;
6717ab
+	return BLKID_PROBE_OK;
6717ab
 
6717ab
 nothing:
6717ab
-	return 1;
6717ab
+	return BLKID_PROBE_NONE;
6717ab
 err:
6717ab
-	return -1;
6717ab
+	return -ENOMEM;
6717ab
 }
6717ab
 
6717ab
 const struct blkid_idinfo solaris_x86_pt_idinfo =
6717ab
diff -up util-linux-2.23.2/libblkid/src/partitions/sun.c.kzak util-linux-2.23.2/libblkid/src/partitions/sun.c
6717ab
--- util-linux-2.23.2/libblkid/src/partitions/sun.c.kzak	2013-06-13 09:46:10.419650613 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/partitions/sun.c	2014-03-28 15:11:44.678551996 +0100
6717ab
@@ -27,8 +27,11 @@ static int probe_sun_pt(blkid_probe pr,
6717ab
 	int i, use_vtoc;
6717ab
 
6717ab
 	l = (struct sun_disklabel *) blkid_probe_get_sector(pr, 0);
6717ab
-	if (!l)
6717ab
+	if (!l) {
6717ab
+		if (errno)
6717ab
+			return -errno;
6717ab
 		goto nothing;
6717ab
+	}
6717ab
 
6717ab
 	if (sun_pt_checksum(l)) {
6717ab
 		DBG(LOWPROBE, blkid_debug(
6717ab
@@ -38,11 +41,11 @@ static int probe_sun_pt(blkid_probe pr,
6717ab
 
6717ab
 	if (blkid_partitions_need_typeonly(pr))
6717ab
 		/* caller does not ask for details about partitions */
6717ab
-		return 0;
6717ab
+		return BLKID_PROBE_OK;
6717ab
 
6717ab
 	ls = blkid_probe_get_partlist(pr);
6717ab
 	if (!ls)
6717ab
-		goto err;
6717ab
+		goto nothing;
6717ab
 
6717ab
 	tab = blkid_partlist_new_parttable(ls, "sun", 0);
6717ab
 	if (!tab)
6717ab
@@ -76,7 +79,7 @@ static int probe_sun_pt(blkid_probe pr,
6717ab
 		uint16_t type = 0, flags = 0;
6717ab
 		blkid_partition par;
6717ab
 
6717ab
-                start = be32_to_cpu(p->start_cylinder) * spc;
6717ab
+		start = be32_to_cpu(p->start_cylinder) * spc;
6717ab
 		size = be32_to_cpu(p->num_sectors);
6717ab
 		if (use_vtoc) {
6717ab
 			type = be16_to_cpu(l->vtoc.infos[i].id);
6717ab
@@ -96,12 +99,12 @@ static int probe_sun_pt(blkid_probe pr,
6717ab
 		if (flags)
6717ab
 			blkid_partition_set_flags(par, flags);
6717ab
 	}
6717ab
-	return 0;
6717ab
+	return BLKID_PROBE_OK;
6717ab
 
6717ab
 nothing:
6717ab
-	return 1;
6717ab
+	return BLKID_PROBE_NONE;
6717ab
 err:
6717ab
-	return -1;
6717ab
+	return -ENOMEM;
6717ab
 }
6717ab
 
6717ab
 
6717ab
diff -up util-linux-2.23.2/libblkid/src/partitions/ultrix.c.kzak util-linux-2.23.2/libblkid/src/partitions/ultrix.c
6717ab
--- util-linux-2.23.2/libblkid/src/partitions/ultrix.c.kzak	2013-05-30 15:21:43.127591380 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/partitions/ultrix.c	2014-03-28 15:11:44.678551996 +0100
6717ab
@@ -44,8 +44,11 @@ static int probe_ultrix_pt(blkid_probe p
6717ab
 	int i;
6717ab
 
6717ab
 	data = blkid_probe_get_sector(pr, ULTRIX_SECTOR);
6717ab
-	if (!data)
6717ab
+	if (!data) {
6717ab
+		if (errno)
6717ab
+			return -errno;
6717ab
 		goto nothing;
6717ab
+	}
6717ab
 
6717ab
 	l = (struct ultrix_disklabel *) (data + ULTRIX_OFFSET);
6717ab
 
6717ab
@@ -59,11 +62,11 @@ static int probe_ultrix_pt(blkid_probe p
6717ab
 
6717ab
 	if (blkid_partitions_need_typeonly(pr))
6717ab
 		/* caller does not ask for details about partitions */
6717ab
-		return 0;
6717ab
+		return BLKID_PROBE_OK;
6717ab
 
6717ab
 	ls = blkid_probe_get_partlist(pr);
6717ab
 	if (!ls)
6717ab
-		goto err;
6717ab
+		goto nothing;
6717ab
 
6717ab
 	tab = blkid_partlist_new_parttable(ls, "ultrix", 0);
6717ab
 	if (!tab)
6717ab
@@ -80,11 +83,11 @@ static int probe_ultrix_pt(blkid_probe p
6717ab
 		}
6717ab
 	}
6717ab
 
6717ab
-	return 0;
6717ab
+	return BLKID_PROBE_OK;
6717ab
 nothing:
6717ab
-	return 1;
6717ab
+	return BLKID_PROBE_NONE;
6717ab
 err:
6717ab
-	return -1;
6717ab
+	return -ENOMEM;
6717ab
 }
6717ab
 
6717ab
 const struct blkid_idinfo ultrix_pt_idinfo =
6717ab
diff -up util-linux-2.23.2/libblkid/src/partitions/unixware.c.kzak util-linux-2.23.2/libblkid/src/partitions/unixware.c
6717ab
--- util-linux-2.23.2/libblkid/src/partitions/unixware.c.kzak	2013-06-13 09:46:10.419650613 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/partitions/unixware.c	2014-03-28 15:11:44.678551996 +0100
6717ab
@@ -106,19 +106,22 @@ static int probe_unixware_pt(blkid_probe
6717ab
 
6717ab
 	l = (struct unixware_disklabel *)
6717ab
 			blkid_probe_get_sector(pr, UNIXWARE_SECTOR);
6717ab
-	if (!l)
6717ab
+	if (!l) {
6717ab
+		if (errno)
6717ab
+			return -errno;
6717ab
 		goto nothing;
6717ab
+	}
6717ab
 
6717ab
 	if (le32_to_cpu(l->vtoc.v_magic) != UNIXWARE_VTOCMAGIC)
6717ab
 		goto nothing;
6717ab
 
6717ab
 	if (blkid_partitions_need_typeonly(pr))
6717ab
 		/* caller does not ask for details about partitions */
6717ab
-		return 0;
6717ab
+		return BLKID_PROBE_OK;
6717ab
 
6717ab
 	ls = blkid_probe_get_partlist(pr);
6717ab
 	if (!ls)
6717ab
-		goto err;
6717ab
+		goto nothing;
6717ab
 
6717ab
 	parent = blkid_partlist_get_parent(ls);
6717ab
 
6717ab
@@ -161,12 +164,12 @@ static int probe_unixware_pt(blkid_probe
6717ab
 		blkid_partition_set_flags(par, flg);
6717ab
 	}
6717ab
 
6717ab
-	return 0;
6717ab
+	return BLKID_PROBE_OK;
6717ab
 
6717ab
 nothing:
6717ab
-	return 1;
6717ab
+	return BLKID_PROBE_NONE;
6717ab
 err:
6717ab
-	return -1;
6717ab
+	return -ENOMEM;
6717ab
 }
6717ab
 
6717ab
 
6717ab
diff -up util-linux-2.23.2/libblkid/src/probe.c.kzak util-linux-2.23.2/libblkid/src/probe.c
6717ab
--- util-linux-2.23.2/libblkid/src/probe.c.kzak	2014-03-28 15:11:18.334283704 +0100
6717ab
+++ util-linux-2.23.2/libblkid/src/probe.c	2014-03-28 15:11:44.678551996 +0100
6717ab
@@ -559,13 +559,17 @@ unsigned char *blkid_probe_get_buffer(bl
6717ab
 	if (!bf) {
6717ab
 		ssize_t ret;
6717ab
 
6717ab
-		if (blkid_llseek(pr->fd, pr->off + off, SEEK_SET) < 0)
6717ab
+		if (blkid_llseek(pr->fd, pr->off + off, SEEK_SET) < 0) {
6717ab
+			errno = 0;
6717ab
 			return NULL;
6717ab
+		}
6717ab
 
6717ab
 		/* allocate info and space for data by why call */
6717ab
 		bf = calloc(1, sizeof(struct blkid_bufinfo) + len);
6717ab
-		if (!bf)
6717ab
+		if (!bf) {
6717ab
+			errno = ENOMEM;
6717ab
 			return NULL;
6717ab
+		}
6717ab
 
6717ab
 		bf->data = ((unsigned char *) bf) + sizeof(struct blkid_bufinfo);
6717ab
 		bf->len = len;
6717ab
@@ -577,7 +581,10 @@ unsigned char *blkid_probe_get_buffer(bl
6717ab
 
6717ab
 		ret = read(pr->fd, bf->data, len);
6717ab
 		if (ret != (ssize_t) len) {
6717ab
+			DBG(LOWPROBE, blkid_debug("\tbuffer read: return %zd error %m", ret));
6717ab
 			free(bf);
6717ab
+			if (ret >= 0)
6717ab
+				errno = 0;
6717ab
 			return NULL;
6717ab
 		}
6717ab
 		list_add_tail(&bf->bufs, &pr->buffers);
6717ab
@@ -766,6 +773,17 @@ int blkid_probe_set_dimension(blkid_prob
6717ab
 	return 0;
6717ab
 }
6717ab
 
6717ab
+/**
6717ab
+ * blkid_probe_get_idmag:
6717ab
+ * @pr: probe
6717ab
+ * @id: id information
6717ab
+ * @offset: begin of probing area
6717ab
+ * @res: found id information
6717ab
+ *
6717ab
+ * Check for matching magic value.
6717ab
+ * Returns BLKID_PROBE_OK if found, BLKID_PROBE_NONE if not found
6717ab
+ * or no magic present, or negative value on error.
6717ab
+ */
6717ab
 int blkid_probe_get_idmag(blkid_probe pr, const struct blkid_idinfo *id,
6717ab
 			blkid_loff_t *offset, const struct blkid_idmag **res)
6717ab
 {
6717ab
@@ -784,6 +802,8 @@ int blkid_probe_get_idmag(blkid_probe pr
6717ab
 		off = (mag->kboff + (mag->sboff >> 10)) << 10;
6717ab
 		buf = blkid_probe_get_buffer(pr, off, 1024);
6717ab
 
6717ab
+		if (!buf && errno)
6717ab
+			return -errno;
6717ab
 		if (buf && !memcmp(mag->magic,
6717ab
 				buf + (mag->sboff & 0x3ff), mag->len)) {
6717ab
 			DBG(LOWPROBE, blkid_debug("\tmagic sboff=%u, kboff=%ld",
6717ab
@@ -792,16 +812,16 @@ int blkid_probe_get_idmag(blkid_probe pr
6717ab
 				*offset = off + (mag->sboff & 0x3ff);
6717ab
 			if (res)
6717ab
 				*res = mag;
6717ab
-			return 0;
6717ab
+			return BLKID_PROBE_OK;
6717ab
 		}
6717ab
 		mag++;
6717ab
 	}
6717ab
 
6717ab
 	if (id && id->magics[0].magic)
6717ab
 		/* magic string(s) defined, but not found */
6717ab
-		return 1;
6717ab
+		return BLKID_PROBE_NONE;
6717ab
 
6717ab
-	return 0;
6717ab
+	return BLKID_PROBE_OK;
6717ab
 }
6717ab
 
6717ab
 static inline void blkid_probe_start(blkid_probe pr)
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/adaptec_raid.c.kzak util-linux-2.23.2/libblkid/src/superblocks/adaptec_raid.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/adaptec_raid.c.kzak	2013-04-08 17:55:40.232855970 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/adaptec_raid.c	2014-03-28 15:11:44.678551996 +0100
6717ab
@@ -80,10 +80,10 @@ static int probe_adraid(blkid_probe pr,
6717ab
 	struct adaptec_metadata *ad;
6717ab
 
6717ab
 	if (pr->size < 0x10000)
6717ab
-		return -1;
6717ab
+		return BLKID_PROBE_NONE;
6717ab
 
6717ab
 	if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
6717ab
-		return -1;
6717ab
+		return BLKID_PROBE_NONE;
6717ab
 
6717ab
 	off = ((pr->size / 0x200)-1) * 0x200;
6717ab
 	ad = (struct adaptec_metadata *)
6717ab
@@ -91,17 +91,19 @@ static int probe_adraid(blkid_probe pr,
6717ab
 					off,
6717ab
 					sizeof(struct adaptec_metadata));
6717ab
 	if (!ad)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : BLKID_PROBE_NONE;;
6717ab
+
6717ab
 	if (ad->smagic != be32_to_cpu(AD_SIGNATURE))
6717ab
-		return -1;
6717ab
+		return BLKID_PROBE_NONE;
6717ab
 	if (ad->b0idcode != be32_to_cpu(AD_MAGIC))
6717ab
-		return -1;
6717ab
+		return BLKID_PROBE_NONE;
6717ab
 	if (blkid_probe_sprintf_version(pr, "%u", ad->resver) != 0)
6717ab
-		return -1;
6717ab
+		return BLKID_PROBE_NONE;
6717ab
 	if (blkid_probe_set_magic(pr, off, sizeof(ad->b0idcode),
6717ab
 				(unsigned char *) &ad->b0idcode))
6717ab
-		return -1;
6717ab
-	return 0;
6717ab
+		return BLKID_PROBE_NONE;
6717ab
+
6717ab
+	return BLKID_PROBE_OK;
6717ab
 }
6717ab
 
6717ab
 const struct blkid_idinfo adraid_idinfo = {
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/befs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/befs.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/befs.c.kzak	2013-04-08 17:55:40.237856017 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/befs.c	2014-03-28 15:11:44.679552006 +0100
6717ab
@@ -261,21 +261,23 @@ static int64_t get_key_value(blkid_probe
6717ab
 	int64_t node_pointer;
6717ab
 	int32_t first, last, mid, cmp;
6717ab
 
6717ab
+	errno = 0;
6717ab
 	bh = (struct bplustree_header *) get_tree_node(pr, bs, &bi->data, 0,
6717ab
 					sizeof(struct bplustree_header), fs_le);
6717ab
 	if (!bh)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : -ENOENT;
6717ab
 
6717ab
 	if ((int32_t) FS32_TO_CPU(bh->magic, fs_le) != BPLUSTREE_MAGIC)
6717ab
-		return -1;
6717ab
+		return -ENOENT;
6717ab
 
6717ab
 	node_pointer = FS64_TO_CPU(bh->root_node_pointer, fs_le);
6717ab
 
6717ab
 	do {
6717ab
+		errno = 0;
6717ab
 		bn = (struct bplustree_node *) get_tree_node(pr, bs, &bi->data,
6717ab
 			node_pointer, FS32_TO_CPU(bh->node_size, fs_le), fs_le);
6717ab
 		if (!bn)
6717ab
-			return -1;
6717ab
+			return errno ? -errno : -ENOENT;
6717ab
 
6717ab
 		keylengths = (uint16_t *) ((uint8_t *) bn
6717ab
 				+ ((sizeof(struct bplustree_node)
6717ab
@@ -336,10 +338,10 @@ static int get_uuid(blkid_probe pr, cons
6717ab
 
6717ab
 	bi = (struct befs_inode *) get_block_run(pr, bs, &bs->root_dir, fs_le);
6717ab
 	if (!bi)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : BLKID_PROBE_NONE;
6717ab
 
6717ab
 	if (FS32_TO_CPU(bi->magic1, fs_le) != INODE_MAGIC1)
6717ab
-		return -1;
6717ab
+		return BLKID_PROBE_NONE;
6717ab
 
6717ab
 	sd = (struct small_data *) bi->small_data;
6717ab
 
6717ab
@@ -376,24 +378,24 @@ static int get_uuid(blkid_probe pr, cons
6717ab
 		bi = (struct befs_inode *) get_block_run(pr, bs,
6717ab
 							&bi->attributes, fs_le);
6717ab
 		if (!bi)
6717ab
-			return -1;
6717ab
+			return errno ? -errno : BLKID_PROBE_NONE;
6717ab
 
6717ab
 		if (FS32_TO_CPU(bi->magic1, fs_le) != INODE_MAGIC1)
6717ab
-			return -1;
6717ab
+			return BLKID_PROBE_NONE;
6717ab
 
6717ab
 		value = get_key_value(pr, bs, bi, KEY_NAME, fs_le);
6717ab
-
6717ab
 		if (value < 0)
6717ab
-			return value;
6717ab
+			return value == -ENOENT ? BLKID_PROBE_NONE : value;
6717ab
+
6717ab
 		else if (value > 0) {
6717ab
 			bi = (struct befs_inode *) blkid_probe_get_buffer(pr,
6717ab
 				value << FS32_TO_CPU(bs->block_shift, fs_le),
6717ab
 				FS32_TO_CPU(bs->block_size, fs_le));
6717ab
 			if (!bi)
6717ab
-				return -1;
6717ab
+				return errno ? -errno : BLKID_PROBE_NONE;
6717ab
 
6717ab
 			if (FS32_TO_CPU(bi->magic1, fs_le) != INODE_MAGIC1)
6717ab
-				return -1;
6717ab
+				return 1;
6717ab
 
6717ab
 			if (FS32_TO_CPU(bi->type, fs_le) == B_UINT64_TYPE
6717ab
 				&& FS64_TO_CPU(bi->data.size, fs_le) == KEY_SIZE
6717ab
@@ -404,7 +406,7 @@ static int get_uuid(blkid_probe pr, cons
6717ab
 				attr_data = (uint64_t *) get_block_run(pr, bs,
6717ab
 						&bi->data.direct[0], fs_le);
6717ab
 				if (!attr_data)
6717ab
-					return -1;
6717ab
+					return errno ? -errno : BLKID_PROBE_NONE;
6717ab
 
6717ab
 				*uuid = *attr_data;
6717ab
 			}
6717ab
@@ -424,7 +426,7 @@ static int probe_befs(blkid_probe pr, co
6717ab
 					mag->sboff - B_OS_NAME_LENGTH,
6717ab
 					sizeof(struct befs_super_block));
6717ab
 	if (!bs)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : BLKID_PROBE_NONE;
6717ab
 
6717ab
 	if (le32_to_cpu(bs->magic1) == SUPER_BLOCK_MAGIC1
6717ab
 		&& le32_to_cpu(bs->magic2) == SUPER_BLOCK_MAGIC2
6717ab
@@ -439,11 +441,11 @@ static int probe_befs(blkid_probe pr, co
6717ab
 		fs_le = 0;
6717ab
 		version = "big-endian";
6717ab
 	} else
6717ab
-		return -1;
6717ab
+		return BLKID_PROBE_NONE;
6717ab
 
6717ab
 	ret = get_uuid(pr, bs, &volume_id, fs_le);
6717ab
 
6717ab
-	if (ret < 0)
6717ab
+	if (ret != 0)
6717ab
 		return ret;
6717ab
 
6717ab
 	/*
6717ab
@@ -459,7 +461,7 @@ static int probe_befs(blkid_probe pr, co
6717ab
 		blkid_probe_sprintf_uuid(pr, (unsigned char *) &volume_id,
6717ab
 					sizeof(volume_id), "%016" PRIx64,
6717ab
 					FS64_TO_CPU(volume_id, fs_le));
6717ab
-	return 0;
6717ab
+	return BLKID_PROBE_OK;
6717ab
 }
6717ab
 
6717ab
 const struct blkid_idinfo befs_idinfo =
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/btrfs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/btrfs.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/btrfs.c.kzak	2014-03-28 15:11:18.335283714 +0100
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/btrfs.c	2014-03-28 15:11:44.679552006 +0100
6717ab
@@ -65,7 +65,7 @@ static int probe_btrfs(blkid_probe pr, c
6717ab
 
6717ab
 	bfs = blkid_probe_get_sb(pr, mag, struct btrfs_super_block);
6717ab
 	if (!bfs)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	if (*bfs->label)
6717ab
 		blkid_probe_set_label(pr,
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/cramfs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/cramfs.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/cramfs.c.kzak	2013-04-08 17:55:40.240856046 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/cramfs.c	2014-03-28 15:11:44.679552006 +0100
6717ab
@@ -40,7 +40,7 @@ static int probe_cramfs(blkid_probe pr,
6717ab
 
6717ab
 	cs = blkid_probe_get_sb(pr, mag, struct cramfs_super);
6717ab
 	if (!cs)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	blkid_probe_set_label(pr, cs->name, sizeof(cs->name));
6717ab
 	return 0;
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/ddf_raid.c.kzak util-linux-2.23.2/libblkid/src/superblocks/ddf_raid.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/ddf_raid.c.kzak	2013-04-08 17:55:40.241856056 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/ddf_raid.c	2014-03-28 15:11:44.679552006 +0100
6717ab
@@ -81,7 +81,7 @@ static int probe_ddf(blkid_probe pr,
6717ab
 	uint64_t off, lba;
6717ab
 
6717ab
 	if (pr->size < 0x30000)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 
6717ab
 	for (i = 0; i < ARRAY_SIZE(hdrs); i++) {
6717ab
 		off = ((pr->size / 0x200) - hdrs[i]) * 0x200;
6717ab
@@ -90,8 +90,7 @@ static int probe_ddf(blkid_probe pr,
6717ab
 					off,
6717ab
 					sizeof(struct ddf_header));
6717ab
 		if (!ddf)
6717ab
-			return -1;
6717ab
-
6717ab
+			return errno ? -errno : 1;
6717ab
 		if (ddf->signature == cpu_to_be32(DDF_MAGIC) ||
6717ab
 		    ddf->signature == cpu_to_le32(DDF_MAGIC))
6717ab
 			break;
6717ab
@@ -99,7 +98,7 @@ static int probe_ddf(blkid_probe pr,
6717ab
 	}
6717ab
 
6717ab
 	if (!ddf)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 
6717ab
 	lba = ddf->signature == cpu_to_be32(DDF_MAGIC) ?
6717ab
 			be64_to_cpu(ddf->primary_lba) :
6717ab
@@ -111,8 +110,12 @@ static int probe_ddf(blkid_probe pr,
6717ab
 
6717ab
 		buf = blkid_probe_get_buffer(pr,
6717ab
 					lba << 9, sizeof(ddf->signature));
6717ab
-		if (!buf || memcmp(buf, &ddf->signature, 4))
6717ab
-			return -1;
6717ab
+		if (!buf) {
6717ab
+			if (errno)
6717ab
+				return -errno;
6717ab
+			if (memcmp(buf, &ddf->signature, 4))
6717ab
+				return 1;
6717ab
+		}
6717ab
 	}
6717ab
 
6717ab
 	blkid_probe_strncpy_uuid(pr, ddf->guid, sizeof(ddf->guid));
6717ab
@@ -121,11 +124,11 @@ static int probe_ddf(blkid_probe pr,
6717ab
 	*(version + sizeof(ddf->ddf_rev)) = '\0';
6717ab
 
6717ab
 	if (blkid_probe_set_version(pr, version) != 0)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	if (blkid_probe_set_magic(pr, off,
6717ab
 			sizeof(ddf->signature),
6717ab
 			(unsigned char *) &ddf->signature))
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	return 0;
6717ab
 }
6717ab
 
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/drbd.c.kzak util-linux-2.23.2/libblkid/src/superblocks/drbd.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/drbd.c.kzak	2013-04-08 17:55:40.243856074 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/drbd.c	2014-03-28 15:11:44.679552006 +0100
6717ab
@@ -75,18 +75,18 @@ static int probe_drbd(blkid_probe pr,
6717ab
 
6717ab
 	/* Small devices cannot be drbd (?) */
6717ab
 	if (pr->size < 0x10000)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 
6717ab
 	md = (struct md_on_disk_08 *)
6717ab
 			blkid_probe_get_buffer(pr,
6717ab
 					off,
6717ab
 					sizeof(struct md_on_disk_08));
6717ab
 	if (!md)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	if (be32_to_cpu(md->magic) != DRBD_MD_MAGIC_08 &&
6717ab
 			be32_to_cpu(md->magic) != DRBD_MD_MAGIC_84_UNCLEAN)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 
6717ab
 	/*
6717ab
 	 * DRBD does not have "real" uuids; the following resembles DRBD's
6717ab
@@ -102,7 +102,7 @@ static int probe_drbd(blkid_probe pr,
6717ab
 				off + offsetof(struct md_on_disk_08, magic),
6717ab
 				sizeof(md->magic),
6717ab
 				(unsigned char *) &md->magic))
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 
6717ab
 	return 0;
6717ab
 }
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/drbdproxy_datalog.c.kzak util-linux-2.23.2/libblkid/src/superblocks/drbdproxy_datalog.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/drbdproxy_datalog.c.kzak	2013-04-08 17:55:40.244856084 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/drbdproxy_datalog.c	2014-03-28 15:11:44.679552006 +0100
6717ab
@@ -33,7 +33,7 @@ static int probe_drbdproxy_datalog(blkid
6717ab
 
6717ab
 	lh = (struct log_header_t *) blkid_probe_get_buffer(pr, 0, sizeof(*lh));
6717ab
 	if (!lh)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	blkid_probe_set_uuid(pr, lh->uuid);
6717ab
 	blkid_probe_sprintf_version(pr, "v%jd", le64_to_cpu(lh->version));
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/exfat.c.kzak util-linux-2.23.2/libblkid/src/superblocks/exfat.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/exfat.c.kzak	2013-04-08 17:55:40.245856093 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/exfat.c	2014-03-28 15:11:44.680552016 +0100
6717ab
@@ -115,12 +115,14 @@ static int probe_exfat(blkid_probe pr, c
6717ab
 
6717ab
 	sb = blkid_probe_get_sb(pr, mag, struct exfat_super_block);
6717ab
 	if (!sb)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : BLKID_PROBE_NONE;
6717ab
 
6717ab
 	label = find_label(pr, sb);
6717ab
 	if (label)
6717ab
 		blkid_probe_set_utf8label(pr, label->name,
6717ab
 				min(label->length * 2, 30), BLKID_ENC_UTF16LE);
6717ab
+	else if (errno)
6717ab
+		return -errno;
6717ab
 
6717ab
 	blkid_probe_sprintf_uuid(pr, sb->volume_serial, 4,
6717ab
 			"%02hhX%02hhX-%02hhX%02hhX",
6717ab
@@ -130,7 +132,7 @@ static int probe_exfat(blkid_probe pr, c
6717ab
 	blkid_probe_sprintf_version(pr, "%u.%u",
6717ab
 			sb->version.major, sb->version.minor);
6717ab
 
6717ab
-	return 0;
6717ab
+	return BLKID_PROBE_OK;
6717ab
 }
6717ab
 
6717ab
 const struct blkid_idinfo exfat_idinfo =
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/ext.c.kzak util-linux-2.23.2/libblkid/src/superblocks/ext.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/ext.c.kzak	2014-03-28 15:11:18.333283694 +0100
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/ext.c	2014-03-28 15:11:44.680552016 +0100
6717ab
@@ -198,9 +198,9 @@ static int probe_jbd(blkid_probe pr,
6717ab
 
6717ab
 	es = ext_get_super(pr, NULL, &fi, NULL);
6717ab
 	if (!es)
6717ab
-		return -BLKID_ERR_PARAM;
6717ab
+		return errno ? -errno : 1;
6717ab
 	if (!(fi & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV))
6717ab
-		return -BLKID_ERR_PARAM;
6717ab
+		return 1;
6717ab
 
6717ab
 	ext_get_info(pr, 2, es);
6717ab
 	return 0;
6717ab
@@ -214,16 +214,16 @@ static int probe_ext2(blkid_probe pr,
6717ab
 
6717ab
 	es = ext_get_super(pr, &fc, &fi, &frc;;
6717ab
 	if (!es)
6717ab
-		return -BLKID_ERR_PARAM;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	/* Distinguish between ext3 and ext2 */
6717ab
 	if (fc & EXT3_FEATURE_COMPAT_HAS_JOURNAL)
6717ab
-		return -BLKID_ERR_PARAM;
6717ab
+		return 1;
6717ab
 
6717ab
 	/* Any features which ext2 doesn't understand */
6717ab
 	if ((frc & EXT2_FEATURE_RO_COMPAT_UNSUPPORTED) ||
6717ab
 	    (fi  & EXT2_FEATURE_INCOMPAT_UNSUPPORTED))
6717ab
-		return -BLKID_ERR_PARAM;
6717ab
+		return 1;
6717ab
 
6717ab
 	ext_get_info(pr, 2, es);
6717ab
 	return 0;
6717ab
@@ -237,16 +237,16 @@ static int probe_ext3(blkid_probe pr,
6717ab
 
6717ab
 	es = ext_get_super(pr, &fc, &fi, &frc;;
6717ab
 	if (!es)
6717ab
-		return -BLKID_ERR_PARAM;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	/* ext3 requires journal */
6717ab
 	if (!(fc & EXT3_FEATURE_COMPAT_HAS_JOURNAL))
6717ab
-		return -BLKID_ERR_PARAM;
6717ab
+		return 1;
6717ab
 
6717ab
 	/* Any features which ext3 doesn't understand */
6717ab
 	if ((frc & EXT3_FEATURE_RO_COMPAT_UNSUPPORTED) ||
6717ab
 	    (fi  & EXT3_FEATURE_INCOMPAT_UNSUPPORTED))
6717ab
-		return -BLKID_ERR_PARAM;
6717ab
+		return 1;
6717ab
 
6717ab
 	ext_get_info(pr, 3, es);
6717ab
 	return 0;
6717ab
@@ -261,14 +261,14 @@ static int probe_ext4dev(blkid_probe pr,
6717ab
 
6717ab
 	es = ext_get_super(pr, &fc, &fi, &frc;;
6717ab
 	if (!es)
6717ab
-		return -BLKID_ERR_PARAM;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	/* Distinguish from jbd */
6717ab
 	if (fi & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV)
6717ab
-		return -BLKID_ERR_PARAM;
6717ab
+		return 1;
6717ab
 
6717ab
 	if (!(le32_to_cpu(es->s_flags) & EXT2_FLAGS_TEST_FILESYS))
6717ab
-		return -BLKID_ERR_PARAM;
6717ab
+		return 1;
6717ab
 
6717ab
 	ext_get_info(pr, 4, es);
6717ab
 	return 0;
6717ab
@@ -282,16 +282,16 @@ static int probe_ext4(blkid_probe pr,
6717ab
 
6717ab
 	es = ext_get_super(pr, &fc, &fi, &frc;;
6717ab
 	if (!es)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	/* Distinguish from jbd */
6717ab
 	if (fi & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV)
6717ab
-		return -BLKID_ERR_PARAM;
6717ab
+		return 1;
6717ab
 
6717ab
 	/* Ext4 has at least one feature which ext3 doesn't understand */
6717ab
 	if (!(frc & EXT3_FEATURE_RO_COMPAT_UNSUPPORTED) &&
6717ab
 	    !(fi  & EXT3_FEATURE_INCOMPAT_UNSUPPORTED))
6717ab
-		return -BLKID_ERR_PARAM;
6717ab
+		return 1;
6717ab
 
6717ab
 	/*
6717ab
 	 * If the filesystem is a OK for use by in-development
6717ab
@@ -304,7 +304,7 @@ static int probe_ext4(blkid_probe pr,
6717ab
 	 * ext4dev.
6717ab
 	 */
6717ab
 	if (le32_to_cpu(es->s_flags) & EXT2_FLAGS_TEST_FILESYS)
6717ab
-		return -BLKID_ERR_PARAM;
6717ab
+		return 1;
6717ab
 
6717ab
 	ext_get_info(pr, 4, es);
6717ab
 	return 0;
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/f2fs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/f2fs.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/f2fs.c.kzak	2013-06-13 09:46:10.422650639 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/f2fs.c	2014-03-28 15:11:44.680552016 +0100
6717ab
@@ -62,7 +62,7 @@ static int probe_f2fs(blkid_probe pr, co
6717ab
 
6717ab
 	sb = blkid_probe_get_sb(pr, mag, struct f2fs_super_block);
6717ab
 	if (!sb)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	major = le16_to_cpu(sb->major_ver);
6717ab
 	minor = le16_to_cpu(sb->minor_ver);
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/gfs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/gfs.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/gfs.c.kzak	2013-04-08 17:55:40.250856141 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/gfs.c	2014-03-28 15:11:44.680552016 +0100
6717ab
@@ -64,7 +64,7 @@ static int probe_gfs(blkid_probe pr, con
6717ab
 
6717ab
 	sbd = blkid_probe_get_sb(pr, mag, struct gfs2_sb);
6717ab
 	if (!sbd)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	if (be32_to_cpu(sbd->sb_fs_format) == GFS_FORMAT_FS &&
6717ab
 	    be32_to_cpu(sbd->sb_multihost_format) == GFS_FORMAT_MULTI)
6717ab
@@ -78,7 +78,7 @@ static int probe_gfs(blkid_probe pr, con
6717ab
 		return 0;
6717ab
 	}
6717ab
 
6717ab
-	return -1;
6717ab
+	return 1;
6717ab
 }
6717ab
 
6717ab
 static int probe_gfs2(blkid_probe pr, const struct blkid_idmag *mag)
6717ab
@@ -87,7 +87,7 @@ static int probe_gfs2(blkid_probe pr, co
6717ab
 
6717ab
 	sbd = blkid_probe_get_sb(pr, mag, struct gfs2_sb);
6717ab
 	if (!sbd)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	if (be32_to_cpu(sbd->sb_fs_format) == GFS2_FORMAT_FS &&
6717ab
 	    be32_to_cpu(sbd->sb_multihost_format) == GFS2_FORMAT_MULTI)
6717ab
@@ -100,7 +100,7 @@ static int probe_gfs2(blkid_probe pr, co
6717ab
 		blkid_probe_set_version(pr, "1");
6717ab
 		return 0;
6717ab
 	}
6717ab
-	return -1;
6717ab
+	return 1;
6717ab
 }
6717ab
 
6717ab
 const struct blkid_idinfo gfs_idinfo =
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/hfs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/hfs.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/hfs.c.kzak	2013-04-08 17:55:40.251856150 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/hfs.c	2014-03-28 15:11:44.680552016 +0100
6717ab
@@ -154,7 +154,7 @@ static int probe_hfs(blkid_probe pr, con
6717ab
 
6717ab
 	hfs = blkid_probe_get_sb(pr, mag, struct hfs_mdb);
6717ab
 	if (!hfs)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	if ((memcmp(hfs->embed_sig, "H+", 2) == 0) ||
6717ab
 	    (memcmp(hfs->embed_sig, "HX", 2) == 0))
6717ab
@@ -193,7 +193,7 @@ static int probe_hfsplus(blkid_probe pr,
6717ab
 
6717ab
 	sbd = blkid_probe_get_sb(pr, mag, struct hfs_mdb);
6717ab
 	if (!sbd)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	/* Check for a HFS+ volume embedded in a HFS volume */
6717ab
 	if (memcmp(sbd->signature, "BD", 2) == 0) {
6717ab
@@ -218,7 +218,7 @@ static int probe_hfsplus(blkid_probe pr,
6717ab
 				struct hfsplus_vol_header);
6717ab
 
6717ab
 	if (!hfsplus)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	if ((memcmp(hfsplus->signature, "H+", 2) != 0) &&
6717ab
 	    (memcmp(hfsplus->signature, "HX", 2) != 0))
6717ab
@@ -228,7 +228,7 @@ static int probe_hfsplus(blkid_probe pr,
6717ab
 
6717ab
 	blocksize = be32_to_cpu(hfsplus->blocksize);
6717ab
 	if (blocksize < HFSPLUS_SECTOR_SIZE)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 
6717ab
 	memcpy(extents, hfsplus->cat_file.extents, sizeof(extents));
6717ab
 	cat_block = be32_to_cpu(extents[0].start_block);
6717ab
@@ -236,7 +236,7 @@ static int probe_hfsplus(blkid_probe pr,
6717ab
 	buf = blkid_probe_get_buffer(pr,
6717ab
 			off + ((blkid_loff_t) cat_block * blocksize), 0x2000);
6717ab
 	if (!buf)
6717ab
-		return 0;
6717ab
+		return errno ? -errno : 0;
6717ab
 
6717ab
 	bnode = (struct hfsplus_bheader_record *)
6717ab
 		&buf[sizeof(struct hfsplus_bnode_descriptor)];
6717ab
@@ -271,7 +271,7 @@ static int probe_hfsplus(blkid_probe pr,
6717ab
 				(blkid_loff_t) off + leaf_off,
6717ab
 				leaf_node_size);
6717ab
 	if (!buf)
6717ab
-		return 0;
6717ab
+		return errno ? -errno : 0;
6717ab
 
6717ab
 	descr = (struct hfsplus_bnode_descriptor *) buf;
6717ab
 	record_count = be16_to_cpu(descr->num_recs);
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/highpoint_raid.c.kzak util-linux-2.23.2/libblkid/src/superblocks/highpoint_raid.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/highpoint_raid.c.kzak	2013-04-08 17:55:40.251856150 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/highpoint_raid.c	2014-03-28 15:11:44.680552016 +0100
6717ab
@@ -30,9 +30,9 @@ static int probe_highpoint45x(blkid_prob
6717ab
 	uint32_t magic;
6717ab
 
6717ab
 	if (pr->size < 0x10000)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 
6717ab
 	off = ((pr->size / 0x200) - 11) * 0x200;
6717ab
 	hpt = (struct hpt45x_metadata *)
6717ab
@@ -40,13 +40,13 @@ static int probe_highpoint45x(blkid_prob
6717ab
 					off,
6717ab
 					sizeof(struct hpt45x_metadata));
6717ab
 	if (!hpt)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 	magic = le32_to_cpu(hpt->magic);
6717ab
 	if (magic != HPT45X_MAGIC_OK && magic != HPT45X_MAGIC_BAD)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	if (blkid_probe_set_magic(pr, off, sizeof(hpt->magic),
6717ab
 				(unsigned char *) &hpt->magic))
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	return 0;
6717ab
 }
6717ab
 
6717ab
@@ -54,7 +54,7 @@ static int probe_highpoint37x(blkid_prob
6717ab
 		const struct blkid_idmag *mag __attribute__((__unused__)))
6717ab
 {
6717ab
 	if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	return 0;
6717ab
 }
6717ab
 
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/hpfs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/hpfs.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/hpfs.c.kzak	2013-04-08 17:55:40.252856159 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/hpfs.c	2014-03-28 15:11:44.680552016 +0100
6717ab
@@ -68,7 +68,7 @@ static int probe_hpfs(blkid_probe pr, co
6717ab
 	/* super block */
6717ab
 	hs = blkid_probe_get_sb(pr, mag, struct hpfs_super_block);
6717ab
 	if (!hs)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 	version = hs->version;
6717ab
 
6717ab
 	/* spare super block */
6717ab
@@ -77,9 +77,9 @@ static int probe_hpfs(blkid_probe pr, co
6717ab
 				HPFS_SBSPARE_OFFSET,
6717ab
 				sizeof(struct hpfs_spare_super));
6717ab
 	if (!hss)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 	if (memcmp(hss->magic, "\x49\x18\x91\xf9", 4) != 0)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 
6717ab
 	/* boot block (with UUID and LABEL) */
6717ab
 	hbb = (struct hpfs_boot_block *)
6717ab
@@ -87,7 +87,7 @@ static int probe_hpfs(blkid_probe pr, co
6717ab
 				0,
6717ab
 				sizeof(struct hpfs_boot_block));
6717ab
 	if (!hbb)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 	if (memcmp(hbb->magic, "\x55\xaa", 2) == 0 &&
6717ab
 	    memcmp(hbb->sig_hpfs, "HPFS", 4) == 0 &&
6717ab
 	    hbb->sig_28h == 0x28) {
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/iso9660.c.kzak util-linux-2.23.2/libblkid/src/superblocks/iso9660.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/iso9660.c.kzak	2013-06-13 09:46:10.422650639 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/iso9660.c	2014-03-28 15:11:44.680552016 +0100
6717ab
@@ -100,7 +100,7 @@ static int probe_iso9660_hsfs(blkid_prob
6717ab
 
6717ab
 	iso = blkid_probe_get_sb(pr, mag, struct high_sierra_volume_descriptor);
6717ab
 	if (!iso)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	blkid_probe_set_version(pr, "High Sierra");
6717ab
 	blkid_probe_set_label(pr, iso->volume_id, sizeof(iso->volume_id));
6717ab
@@ -178,7 +178,7 @@ int probe_iso9660(blkid_probe pr, const
6717ab
 
6717ab
 	iso = blkid_probe_get_sb(pr, mag, struct iso_volume_descriptor);
6717ab
 	if (!iso)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	memcpy(label, iso->volume_id, sizeof(label));
6717ab
 
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/isw_raid.c.kzak util-linux-2.23.2/libblkid/src/superblocks/isw_raid.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/isw_raid.c.kzak	2013-04-08 17:55:40.252856159 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/isw_raid.c	2014-03-28 15:11:44.680552016 +0100
6717ab
@@ -33,9 +33,9 @@ static int probe_iswraid(blkid_probe pr,
6717ab
 	struct isw_metadata *isw;
6717ab
 
6717ab
 	if (pr->size < 0x10000)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 
6717ab
 	off = ((pr->size / 0x200) - 2) * 0x200;
6717ab
 	isw = (struct isw_metadata *)
6717ab
@@ -43,15 +43,16 @@ static int probe_iswraid(blkid_probe pr,
6717ab
 					off,
6717ab
 					sizeof(struct isw_metadata));
6717ab
 	if (!isw)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
+
6717ab
 	if (memcmp(isw->sig, ISW_SIGNATURE, sizeof(ISW_SIGNATURE)-1) != 0)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	if (blkid_probe_sprintf_version(pr, "%6s",
6717ab
 			&isw->sig[sizeof(ISW_SIGNATURE)-1]) != 0)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	if (blkid_probe_set_magic(pr, off, sizeof(isw->sig),
6717ab
 				(unsigned char *) isw->sig))
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	return 0;
6717ab
 }
6717ab
 
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/jfs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/jfs.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/jfs.c.kzak	2013-04-08 17:55:40.253856169 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/jfs.c	2014-03-28 15:11:44.681552026 +0100
6717ab
@@ -40,7 +40,7 @@ static int probe_jfs(blkid_probe pr, con
6717ab
 
6717ab
 	js = blkid_probe_get_sb(pr, mag, struct jfs_super_block);
6717ab
 	if (!js)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 	if (le32_to_cpu(js->js_bsize) != (1U << le16_to_cpu(js->js_l2bsize)))
6717ab
 		return 1;
6717ab
 	if (le32_to_cpu(js->js_pbsize) != (1U << le16_to_cpu(js->js_l2pbsize)))
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/jmicron_raid.c.kzak util-linux-2.23.2/libblkid/src/superblocks/jmicron_raid.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/jmicron_raid.c.kzak	2013-04-08 17:55:40.253856169 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/jmicron_raid.c	2014-03-28 15:11:44.681552026 +0100
6717ab
@@ -32,9 +32,9 @@ static int probe_jmraid(blkid_probe pr,
6717ab
 	struct jm_metadata *jm;
6717ab
 
6717ab
 	if (pr->size < 0x10000)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 
6717ab
 	off = ((pr->size / 0x200) - 1) * 0x200;
6717ab
 	jm = (struct jm_metadata *)
6717ab
@@ -42,15 +42,16 @@ static int probe_jmraid(blkid_probe pr,
6717ab
 				off,
6717ab
 				sizeof(struct jm_metadata));
6717ab
 	if (!jm)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
+
6717ab
 	if (memcmp(jm->signature, JM_SIGNATURE, sizeof(JM_SIGNATURE) - 1) != 0)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	if (blkid_probe_sprintf_version(pr, "%u.%u",
6717ab
 				jm->major_version, jm->minor_version) != 0)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	if (blkid_probe_set_magic(pr, off, sizeof(jm->signature),
6717ab
 				(unsigned char *) jm->signature))
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	return 0;
6717ab
 }
6717ab
 
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/linux_raid.c.kzak util-linux-2.23.2/libblkid/src/superblocks/linux_raid.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/linux_raid.c.kzak	2013-04-08 17:55:40.253856169 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/linux_raid.c	2014-03-28 15:11:44.681552026 +0100
6717ab
@@ -110,13 +110,13 @@ static int probe_raid0(blkid_probe pr, b
6717ab
 	uint64_t size;
6717ab
 
6717ab
 	if (pr->size < MD_RESERVED_BYTES)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	mdp0 = (struct mdp0_super_block *)
6717ab
 			blkid_probe_get_buffer(pr,
6717ab
 				off,
6717ab
 				sizeof(struct mdp0_super_block));
6717ab
 	if (!mdp0)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	memset(uuid.ints, 0, sizeof(uuid.ints));
6717ab
 
6717ab
@@ -173,12 +173,12 @@ static int probe_raid0(blkid_probe pr, b
6717ab
 	}
6717ab
 
6717ab
 	if (blkid_probe_sprintf_version(pr, "%u.%u.%u", ma, mi, pa) != 0)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	if (blkid_probe_set_uuid(pr, (unsigned char *) uuid.bytes) != 0)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	if (blkid_probe_set_magic(pr, off, sizeof(mdp0->md_magic),
6717ab
 				(unsigned char *) &mdp0->md_magic))
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	return 0;
6717ab
 }
6717ab
 
6717ab
@@ -191,24 +191,24 @@ static int probe_raid1(blkid_probe pr, o
6717ab
 				off,
6717ab
 				sizeof(struct mdp1_super_block));
6717ab
 	if (!mdp1)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 	if (le32_to_cpu(mdp1->magic) != MD_SB_MAGIC)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	if (le32_to_cpu(mdp1->major_version) != 1U)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	if (le64_to_cpu(mdp1->super_offset) != (uint64_t) off >> 9)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	if (blkid_probe_set_uuid(pr, (unsigned char *) mdp1->set_uuid) != 0)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	if (blkid_probe_set_uuid_as(pr,
6717ab
 			(unsigned char *) mdp1->device_uuid, "UUID_SUB") != 0)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	if (blkid_probe_set_label(pr, mdp1->set_name,
6717ab
 				sizeof(mdp1->set_name)) != 0)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	if (blkid_probe_set_magic(pr, off, sizeof(mdp1->magic),
6717ab
 				(unsigned char *) &mdp1->magic))
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	return 0;
6717ab
 }
6717ab
 
6717ab
@@ -216,35 +216,44 @@ int probe_raid(blkid_probe pr,
6717ab
 		const struct blkid_idmag *mag __attribute__((__unused__)))
6717ab
 {
6717ab
 	const char *ver = NULL;
6717ab
+	int ret = BLKID_PROBE_NONE;
6717ab
 
6717ab
 	if (pr->size > MD_RESERVED_BYTES) {
6717ab
 		/* version 0 at the end of the device */
6717ab
 		uint64_t sboff = (pr->size & ~(MD_RESERVED_BYTES - 1))
6717ab
-			         - MD_RESERVED_BYTES;
6717ab
-		if (probe_raid0(pr, sboff) == 0)
6717ab
-			return 0;
6717ab
+			- MD_RESERVED_BYTES;
6717ab
+		ret = probe_raid0(pr, sboff);
6717ab
+		if (ret < 1)
6717ab
+			return ret;	/* error */
6717ab
 
6717ab
 		/* version 1.0 at the end of the device */
6717ab
 		sboff = (pr->size & ~(0x1000 - 1)) - 0x2000;
6717ab
-		if (probe_raid1(pr, sboff) == 0)
6717ab
+		ret = probe_raid1(pr, sboff);
6717ab
+		if (ret < 0)
6717ab
+			return ret;	/* error */
6717ab
+		if (ret == 0)
6717ab
 			ver = "1.0";
6717ab
 	}
6717ab
 
6717ab
 	if (!ver) {
6717ab
 		/* version 1.1 at the start of the device */
6717ab
-		if (probe_raid1(pr, 0) == 0)
6717ab
+		ret = probe_raid1(pr, 0);
6717ab
+		if (ret == 0)
6717ab
 			ver = "1.1";
6717ab
 
6717ab
 		/* version 1.2 at 4k offset from the start */
6717ab
-		else if (probe_raid1(pr, 0x1000) == 0)
6717ab
-			ver = "1.2";
6717ab
+		else if (ret == BLKID_PROBE_NONE) {
6717ab
+			ret = probe_raid1(pr, 0x1000);
6717ab
+			if (ret == 0)
6717ab
+				ver = "1.2";
6717ab
+		}
6717ab
 	}
6717ab
 
6717ab
 	if (ver) {
6717ab
 		blkid_probe_set_version(pr, ver);
6717ab
-		return 0;
6717ab
+		return BLKID_PROBE_OK;
6717ab
 	}
6717ab
-	return -1;
6717ab
+	return ret;
6717ab
 }
6717ab
 
6717ab
 
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/lsi_raid.c.kzak util-linux-2.23.2/libblkid/src/superblocks/lsi_raid.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/lsi_raid.c.kzak	2013-04-08 17:55:40.254856179 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/lsi_raid.c	2014-03-28 15:11:44.681552026 +0100
6717ab
@@ -30,9 +30,9 @@ static int probe_lsiraid(blkid_probe pr,
6717ab
 	struct lsi_metadata *lsi;
6717ab
 
6717ab
 	if (pr->size < 0x10000)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 
6717ab
 	off = ((pr->size / 0x200) - 1) * 0x200;
6717ab
 	lsi = (struct lsi_metadata *)
6717ab
@@ -40,13 +40,13 @@ static int probe_lsiraid(blkid_probe pr,
6717ab
 				off,
6717ab
 				sizeof(struct lsi_metadata));
6717ab
 	if (!lsi)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	if (memcmp(lsi->sig, LSI_SIGNATURE, sizeof(LSI_SIGNATURE)-1) != 0)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	if (blkid_probe_set_magic(pr, off, sizeof(lsi->sig),
6717ab
 				(unsigned char *) lsi->sig))
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	return 0;
6717ab
 }
6717ab
 
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/luks.c.kzak util-linux-2.23.2/libblkid/src/superblocks/luks.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/luks.c.kzak	2013-04-08 17:55:40.254856179 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/luks.c	2014-03-28 15:11:44.681552026 +0100
6717ab
@@ -45,7 +45,7 @@ static int probe_luks(blkid_probe pr, co
6717ab
 
6717ab
 	header = blkid_probe_get_sb(pr, mag, struct luks_phdr);
6717ab
 	if (header == NULL)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	blkid_probe_strncpy_uuid(pr, (unsigned char *) header->uuid,
6717ab
 			sizeof(header->uuid));
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/lvm.c.kzak util-linux-2.23.2/libblkid/src/superblocks/lvm.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/lvm.c.kzak	2013-06-13 09:46:10.422650639 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/lvm.c	2014-03-28 15:11:44.681552026 +0100
6717ab
@@ -82,7 +82,7 @@ static int probe_lvm2(blkid_probe pr, co
6717ab
 			mag->kboff << 10,
6717ab
 			512 + sizeof(struct lvm2_pv_label_header));
6717ab
 	if (!buf)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	/* buf is at 0k or 1k offset; find label inside */
6717ab
 	if (memcmp(buf, "LABELONE", 8) == 0) {
6717ab
@@ -129,7 +129,7 @@ static int probe_lvm1(blkid_probe pr, co
6717ab
 
6717ab
 	label = blkid_probe_get_sb(pr, mag, struct lvm1_pv_label_header);
6717ab
 	if (!label)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	version = le16_to_cpu(label->version);
6717ab
 	if (version != 1 && version != 2)
6717ab
@@ -164,7 +164,7 @@ static int probe_verity(blkid_probe pr,
6717ab
 
6717ab
 	sb = blkid_probe_get_sb(pr, mag, struct verity_sb);
6717ab
 	if (sb == NULL)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	version = le32_to_cpu(sb->version);
6717ab
 	if (version != 1)
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/minix.c.kzak util-linux-2.23.2/libblkid/src/superblocks/minix.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/minix.c.kzak	2013-06-13 09:46:10.423650647 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/minix.c	2014-03-28 15:11:44.681552026 +0100
6717ab
@@ -80,17 +80,17 @@ static int probe_minix(blkid_probe pr, c
6717ab
 			max(sizeof(struct minix_super_block),
6717ab
 			    sizeof(struct minix3_super_block)));
6717ab
 	if (!data)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 	version = get_minix_version(data, &swabme);
6717ab
 	if (version < 1)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 
6717ab
 	if (version <= 2) {
6717ab
 		struct minix_super_block *sb = (struct minix_super_block *) data;
6717ab
 		int zones, ninodes, imaps, zmaps, firstz;
6717ab
 
6717ab
 		if (sb->s_imap_blocks == 0 || sb->s_zmap_blocks == 0)
6717ab
-			return -1;
6717ab
+			return 1;
6717ab
 
6717ab
 		zones = version == 2 ? minix_swab32(swabme, sb->s_zones) :
6717ab
 				       minix_swab16(swabme, sb->s_nzones);
6717ab
@@ -101,15 +101,15 @@ static int probe_minix(blkid_probe pr, c
6717ab
 
6717ab
 		/* sanity checks to be sure that the FS is really minix */
6717ab
 		if (imaps * MINIX_BLOCK_SIZE * 8 < ninodes + 1)
6717ab
-			return -1;
6717ab
+			return 1;
6717ab
 		if (zmaps * MINIX_BLOCK_SIZE * 8 < zones - firstz + 1)
6717ab
-			return -1;
6717ab
+			return 1;
6717ab
 
6717ab
 	} else if (version == 3) {
6717ab
 		struct minix3_super_block *sb = (struct minix3_super_block *) data;
6717ab
 
6717ab
 		if (sb->s_imap_blocks == 0 || sb->s_zmap_blocks == 0)
6717ab
-			return -1;
6717ab
+			return 1;
6717ab
 	}
6717ab
 
6717ab
 	/* unfortunately, some parts of ext3 is sometimes possible to
6717ab
@@ -117,8 +117,10 @@ static int probe_minix(blkid_probe pr, c
6717ab
 	 * string. (For extN magic string and offsets see ext.c.)
6717ab
 	 */
6717ab
 	ext = blkid_probe_get_buffer(pr, 0x400 + 0x38, 2);
6717ab
-	if (ext && memcmp(ext, "\123\357", 2) == 0)
6717ab
-		return -1;
6717ab
+	if (!ext)
6717ab
+		return errno ? -errno : 1;
6717ab
+	else if (memcmp(ext, "\123\357", 2) == 0)
6717ab
+		return 1;
6717ab
 
6717ab
 	blkid_probe_sprintf_version(pr, "%d", version);
6717ab
 	return 0;
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/netware.c.kzak util-linux-2.23.2/libblkid/src/superblocks/netware.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/netware.c.kzak	2013-04-08 17:55:40.255856188 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/netware.c	2014-03-28 15:11:44.681552026 +0100
6717ab
@@ -71,7 +71,7 @@ static int probe_netware(blkid_probe pr,
6717ab
 
6717ab
 	nw = blkid_probe_get_sb(pr, mag, struct netware_super_block);
6717ab
 	if (!nw)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	blkid_probe_set_uuid(pr, nw->SBH_PoolID);
6717ab
 
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/nilfs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/nilfs.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/nilfs.c.kzak	2013-04-08 17:55:40.256856198 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/nilfs.c	2014-03-28 15:11:44.681552026 +0100
6717ab
@@ -82,7 +82,7 @@ static int probe_nilfs2(blkid_probe pr,
6717ab
 
6717ab
 	sb = blkid_probe_get_sb(pr, mag, struct nilfs_super_block);
6717ab
 	if (!sb)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	bytes = le16_to_cpu(sb->s_bytes);
6717ab
 	crc = crc32(le32_to_cpu(sb->s_crc_seed), (unsigned char *)sb, sumoff);
6717ab
@@ -90,7 +90,7 @@ static int probe_nilfs2(blkid_probe pr,
6717ab
 	crc = crc32(crc, (unsigned char *)sb + sumoff + 4, bytes - sumoff - 4);
6717ab
 
6717ab
 	if (crc != le32_to_cpu(sb->s_sum))
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 
6717ab
 	if (strlen(sb->s_volume_name))
6717ab
 		blkid_probe_set_label(pr, (unsigned char *) sb->s_volume_name,
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/ntfs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/ntfs.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/ntfs.c.kzak	2013-06-13 09:46:10.423650647 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/ntfs.c	2014-03-28 15:11:44.681552026 +0100
6717ab
@@ -91,7 +91,7 @@ static int probe_ntfs(blkid_probe pr, co
6717ab
 
6717ab
 	ns = blkid_probe_get_sb(pr, mag, struct ntfs_super_block);
6717ab
 	if (!ns)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	/*
6717ab
 	 * Check bios parameters block
6717ab
@@ -158,7 +158,7 @@ static int probe_ntfs(blkid_probe pr, co
6717ab
 
6717ab
 	buf_mft = blkid_probe_get_buffer(pr, off, mft_record_size);
6717ab
 	if (!buf_mft)
6717ab
-		return 1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	if (memcmp(buf_mft, "FILE", 4))
6717ab
 		return 1;
6717ab
@@ -167,7 +167,7 @@ static int probe_ntfs(blkid_probe pr, co
6717ab
 
6717ab
 	buf_mft = blkid_probe_get_buffer(pr, off, mft_record_size);
6717ab
 	if (!buf_mft)
6717ab
-		return 1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	if (memcmp(buf_mft, "FILE", 4))
6717ab
 		return 1;
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/nvidia_raid.c.kzak util-linux-2.23.2/libblkid/src/superblocks/nvidia_raid.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/nvidia_raid.c.kzak	2013-04-08 17:55:40.257856207 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/nvidia_raid.c	2014-03-28 15:11:44.682552036 +0100
6717ab
@@ -32,9 +32,9 @@ static int probe_nvraid(blkid_probe pr,
6717ab
 	struct nv_metadata *nv;
6717ab
 
6717ab
 	if (pr->size < 0x10000)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 
6717ab
 	off = ((pr->size / 0x200) - 2) * 0x200;
6717ab
 	nv = (struct nv_metadata *)
6717ab
@@ -42,15 +42,15 @@ static int probe_nvraid(blkid_probe pr,
6717ab
 				off,
6717ab
 				sizeof(struct nv_metadata));
6717ab
 	if (!nv)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	if (memcmp(nv->vendor, NVIDIA_SIGNATURE, sizeof(NVIDIA_SIGNATURE)-1) != 0)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	if (blkid_probe_sprintf_version(pr, "%u", le16_to_cpu(nv->version)) != 0)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	if (blkid_probe_set_magic(pr, off, sizeof(nv->vendor),
6717ab
 				(unsigned char *) nv->vendor))
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	return 0;
6717ab
 }
6717ab
 
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/ocfs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/ocfs.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/ocfs.c.kzak	2013-04-08 17:55:40.257856207 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/ocfs.c	2014-03-28 15:11:44.682552036 +0100
6717ab
@@ -109,14 +109,14 @@ static int probe_ocfs(blkid_probe pr, co
6717ab
 	buf = blkid_probe_get_buffer(pr, mag->kboff << 10,
6717ab
 			sizeof(struct ocfs_volume_header));
6717ab
 	if (!buf)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 	memcpy(&ovh, buf, sizeof(ovh));
6717ab
 
6717ab
 	/* label */
6717ab
 	buf = blkid_probe_get_buffer(pr, (mag->kboff << 10) + 512,
6717ab
 			sizeof(struct ocfs_volume_label));
6717ab
 	if (!buf)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 	memcpy(&ovl, buf, sizeof(ovl));
6717ab
 
6717ab
 	maj = ocfsmajor(ovh);
6717ab
@@ -144,7 +144,7 @@ static int probe_ocfs2(blkid_probe pr, c
6717ab
 
6717ab
 	osb = blkid_probe_get_sb(pr, mag, struct ocfs2_super_block);
6717ab
 	if (!osb)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	blkid_probe_set_label(pr, (unsigned char *) osb->s_label, sizeof(osb->s_label));
6717ab
 	blkid_probe_set_uuid(pr, osb->s_uuid);
6717ab
@@ -162,7 +162,7 @@ static int probe_oracleasm(blkid_probe p
6717ab
 
6717ab
 	dl = blkid_probe_get_sb(pr, mag, struct oracle_asm_disk_label);
6717ab
 	if (!dl)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	blkid_probe_set_label(pr, (unsigned char *) dl->dl_id, sizeof(dl->dl_id));
6717ab
 	return 0;
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/promise_raid.c.kzak util-linux-2.23.2/libblkid/src/superblocks/promise_raid.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/promise_raid.c.kzak	2013-06-13 09:46:10.423650647 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/promise_raid.c	2014-03-28 15:11:44.682552036 +0100
6717ab
@@ -33,9 +33,9 @@ static int probe_pdcraid(blkid_probe pr,
6717ab
 	};
6717ab
 
6717ab
 	if (pr->size < 0x40000)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 
6717ab
 	for (i = 0; sectors[i] != 0; i++) {
6717ab
 		uint64_t off;
6717ab
@@ -47,18 +47,18 @@ static int probe_pdcraid(blkid_probe pr,
6717ab
 					off,
6717ab
 					sizeof(struct promise_metadata));
6717ab
 		if (!pdc)
6717ab
-			return -1;
6717ab
+			return errno ? -errno : 1;
6717ab
 
6717ab
 		if (memcmp(pdc->sig, PDC_SIGNATURE,
6717ab
 				sizeof(PDC_SIGNATURE) - 1) == 0) {
6717ab
 
6717ab
 			if (blkid_probe_set_magic(pr, off, sizeof(pdc->sig),
6717ab
 						(unsigned char *) pdc->sig))
6717ab
-				return -1;
6717ab
+				return 1;
6717ab
 			return 0;
6717ab
 		}
6717ab
 	}
6717ab
-	return -1;
6717ab
+	return 1;
6717ab
 }
6717ab
 
6717ab
 const struct blkid_idinfo pdcraid_idinfo = {
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/reiserfs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/reiserfs.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/reiserfs.c.kzak	2013-04-08 17:55:40.258856216 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/reiserfs.c	2014-03-28 15:11:44.682552036 +0100
6717ab
@@ -45,17 +45,17 @@ static int probe_reiser(blkid_probe pr,
6717ab
 
6717ab
 	rs = blkid_probe_get_sb(pr, mag, struct reiserfs_super_block);
6717ab
 	if (!rs)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	blocksize = le16_to_cpu(rs->rs_blocksize);
6717ab
 
6717ab
 	/* The blocksize must be at least 512B */
6717ab
 	if ((blocksize >> 9) == 0)
6717ab
-		return -BLKID_ERR_PARAM;
6717ab
+		return 1;
6717ab
 
6717ab
 	/* If the superblock is inside the journal, we have the wrong one */
6717ab
 	if (mag->kboff / (blocksize >> 9) > le32_to_cpu(rs->rs_journal_block) / 2)
6717ab
-		return -BLKID_ERR_BIG;
6717ab
+		return 1;
6717ab
 
6717ab
 	/* LABEL/UUID are only valid for later versions of Reiserfs v3.6. */
6717ab
 	if (mag->magic[6] == '2' || mag->magic[6] == '3') {
6717ab
@@ -82,7 +82,7 @@ static int probe_reiser4(blkid_probe pr,
6717ab
 
6717ab
 	rs4 = blkid_probe_get_sb(pr, mag, struct reiser4_super_block);
6717ab
 	if (!rs4)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	if (*rs4->rs4_label)
6717ab
 		blkid_probe_set_label(pr, rs4->rs4_label, sizeof(rs4->rs4_label));
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/romfs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/romfs.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/romfs.c.kzak	2013-04-08 17:55:40.258856216 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/romfs.c	2014-03-28 15:11:44.682552036 +0100
6717ab
@@ -29,7 +29,7 @@ static int probe_romfs(blkid_probe pr, c
6717ab
 
6717ab
 	ros = blkid_probe_get_sb(pr, mag, struct romfs_super_block);
6717ab
 	if (!ros)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	if (strlen((char *) ros->ros_volume))
6717ab
 		blkid_probe_set_label(pr, ros->ros_volume,
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/silicon_raid.c.kzak util-linux-2.23.2/libblkid/src/superblocks/silicon_raid.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/silicon_raid.c.kzak	2013-06-13 09:46:10.424650656 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/silicon_raid.c	2014-03-28 15:11:44.682552036 +0100
6717ab
@@ -88,9 +88,9 @@ static int probe_silraid(blkid_probe pr,
6717ab
 	struct silicon_metadata *sil;
6717ab
 
6717ab
 	if (pr->size < 0x10000)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 
6717ab
 	off = ((pr->size / 0x200) - 1) * 0x200;
6717ab
 
6717ab
@@ -98,27 +98,27 @@ static int probe_silraid(blkid_probe pr,
6717ab
 			blkid_probe_get_buffer(pr, off,
6717ab
 				sizeof(struct silicon_metadata));
6717ab
 	if (!sil)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	if (le32_to_cpu(sil->magic) != SILICON_MAGIC)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	if (sil->disk_number >= 8)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	if (!checksum(sil)) {
6717ab
 		DBG(LOWPROBE, blkid_debug("silicon raid: incorrect checksum"));
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	}
6717ab
 
6717ab
 	if (blkid_probe_sprintf_version(pr, "%u.%u",
6717ab
 				le16_to_cpu(sil->major_ver),
6717ab
 				le16_to_cpu(sil->minor_ver)) != 0)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 
6717ab
 	if (blkid_probe_set_magic(pr,
6717ab
 			off + offsetof(struct silicon_metadata, magic),
6717ab
 			sizeof(sil->magic),
6717ab
 			(unsigned char *) &sil->magic))
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	return 0;
6717ab
 }
6717ab
 
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/squashfs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/squashfs.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/squashfs.c.kzak	2013-04-08 17:55:40.258856216 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/squashfs.c	2014-03-28 15:11:44.682552036 +0100
6717ab
@@ -34,7 +34,7 @@ static int probe_squashfs(blkid_probe pr
6717ab
 
6717ab
 	sq = blkid_probe_get_sb(pr, mag, struct sqsh_super_block);
6717ab
 	if (!sq)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	if (strcmp(mag->magic, "sqsh") == 0 ||
6717ab
 	    strcmp(mag->magic, "qshs") == 0)
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/superblocks.c.kzak util-linux-2.23.2/libblkid/src/superblocks/superblocks.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/superblocks.c.kzak	2013-07-30 10:39:26.209738269 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/superblocks.c	2014-03-28 15:11:44.682552036 +0100
6717ab
@@ -331,9 +331,10 @@ int blkid_superblocks_get_name(size_t id
6717ab
 static int superblocks_probe(blkid_probe pr, struct blkid_chain *chn)
6717ab
 {
6717ab
 	size_t i;
6717ab
+	int rc = BLKID_PROBE_NONE;
6717ab
 
6717ab
 	if (!pr || chn->idx < -1)
6717ab
-		return -1;
6717ab
+		return -EINVAL;
6717ab
 	blkid_probe_chain_reset_vals(pr, chn);
6717ab
 
6717ab
 	DBG(LOWPROBE, blkid_debug("--> starting probing loop [SUBLKS idx=%d]",
6717ab
@@ -351,38 +352,50 @@ static int superblocks_probe(blkid_probe
6717ab
 		const struct blkid_idinfo *id;
6717ab
 		const struct blkid_idmag *mag = NULL;
6717ab
 		blkid_loff_t off = 0;
6717ab
-		int rc = 0;
6717ab
 
6717ab
 		chn->idx = i;
6717ab
 		id = idinfos[i];
6717ab
 
6717ab
 		if (chn->fltr && blkid_bmp_get_item(chn->fltr, i)) {
6717ab
 			DBG(LOWPROBE, blkid_debug("filter out: %s", id->name));
6717ab
+			rc = BLKID_PROBE_NONE;
6717ab
 			continue;
6717ab
 		}
6717ab
 
6717ab
-		if (id->minsz && id->minsz > pr->size)
6717ab
+		if (id->minsz && id->minsz > pr->size) {
6717ab
+			rc = BLKID_PROBE_NONE;
6717ab
 			continue;	/* the device is too small */
6717ab
+		}
6717ab
 
6717ab
 		/* don't probe for RAIDs, swap or journal on CD/DVDs */
6717ab
 		if ((id->usage & (BLKID_USAGE_RAID | BLKID_USAGE_OTHER)) &&
6717ab
-		    blkid_probe_is_cdrom(pr))
6717ab
+		    blkid_probe_is_cdrom(pr)) {
6717ab
+			rc = BLKID_PROBE_NONE;
6717ab
 			continue;
6717ab
+		}
6717ab
 
6717ab
 		/* don't probe for RAIDs on floppies */
6717ab
-		if ((id->usage & BLKID_USAGE_RAID) && blkid_probe_is_tiny(pr))
6717ab
+		if ((id->usage & BLKID_USAGE_RAID) && blkid_probe_is_tiny(pr)) {
6717ab
+			rc = BLKID_PROBE_NONE;
6717ab
 			continue;
6717ab
+		}
6717ab
 
6717ab
 		DBG(LOWPROBE, blkid_debug("[%zd] %s:", i, id->name));
6717ab
 
6717ab
-		if (blkid_probe_get_idmag(pr, id, &off, &mag))
6717ab
+		rc = blkid_probe_get_idmag(pr, id, &off, &mag;;
6717ab
+		if (rc < 0)
6717ab
+			break;
6717ab
+		if (rc != BLKID_PROBE_OK)
6717ab
 			continue;
6717ab
 
6717ab
 		/* final check by probing function */
6717ab
 		if (id->probefunc) {
6717ab
 			DBG(LOWPROBE, blkid_debug("\tcall probefunc()"));
6717ab
-			if (id->probefunc(pr, mag) != 0) {
6717ab
+			rc = id->probefunc(pr, mag);
6717ab
+			if (rc != BLKID_PROBE_OK) {
6717ab
 				blkid_probe_chain_reset_vals(pr, chn);
6717ab
+				if (rc < 0)
6717ab
+					break;
6717ab
 				continue;
6717ab
 			}
6717ab
 		}
6717ab
@@ -407,13 +420,13 @@ static int superblocks_probe(blkid_probe
6717ab
 
6717ab
 		DBG(LOWPROBE, blkid_debug("<-- leaving probing loop (type=%s) [SUBLKS idx=%d]",
6717ab
 			id->name, chn->idx));
6717ab
-		return 0;
6717ab
+		return BLKID_PROBE_OK;
6717ab
 	}
6717ab
 
6717ab
 nothing:
6717ab
-	DBG(LOWPROBE, blkid_debug("<-- leaving probing loop (failed) [SUBLKS idx=%d]",
6717ab
-		chn->idx));
6717ab
-	return 1;
6717ab
+	DBG(LOWPROBE, blkid_debug("<-- leaving probing loop (failed=%d) [SUBLKS idx=%d]",
6717ab
+			rc, chn->idx));
6717ab
+	return rc;
6717ab
 }
6717ab
 
6717ab
 /*
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/swap.c.kzak util-linux-2.23.2/libblkid/src/superblocks/swap.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/swap.c.kzak	2013-06-13 09:46:10.425650665 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/swap.c	2014-03-28 15:11:44.682552036 +0100
6717ab
@@ -44,17 +44,17 @@ static int swap_set_info(blkid_probe pr,
6717ab
 	hdr = (struct swap_header_v1_2 *) blkid_probe_get_buffer(pr, 1024,
6717ab
 				sizeof(struct swap_header_v1_2));
6717ab
 	if (!hdr)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	/* SWAPSPACE2 - check for wrong version or zeroed pagecount */
6717ab
         if (strcmp(version, "2") == 0) {
6717ab
 		if (hdr->version != 1 && swab32(hdr->version) != 1) {
6717ab
 			DBG(LOWPROBE, blkid_debug("incorrect swap version"));
6717ab
-			return -1;
6717ab
+			return 1;
6717ab
 		}
6717ab
 		if (hdr->lastpage == 0) {
6717ab
 			DBG(LOWPROBE, blkid_debug("not set last swap page"));
6717ab
-			return -1;
6717ab
+			return 1;
6717ab
 		}
6717ab
         }
6717ab
 
6717ab
@@ -62,9 +62,9 @@ static int swap_set_info(blkid_probe pr,
6717ab
 	if (hdr->padding[32] == 0 && hdr->padding[33] == 0) {
6717ab
 		if (hdr->volume[0] && blkid_probe_set_label(pr, hdr->volume,
6717ab
 				sizeof(hdr->volume)) < 0)
6717ab
-			return -1;
6717ab
+			return 1;
6717ab
 		if (blkid_probe_set_uuid(pr, hdr->uuid) < 0)
6717ab
-			return -1;
6717ab
+			return 1;
6717ab
 	}
6717ab
 
6717ab
 	blkid_probe_set_version(pr, version);
6717ab
@@ -76,12 +76,12 @@ static int probe_swap(blkid_probe pr, co
6717ab
 	unsigned char *buf;
6717ab
 
6717ab
 	if (!mag)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 
6717ab
 	/* TuxOnIce keeps valid swap header at the end of the 1st page */
6717ab
 	buf = blkid_probe_get_buffer(pr, 0, TOI_MAGIC_STRLEN);
6717ab
 	if (!buf)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	if (memcmp(buf, TOI_MAGIC_STRING, TOI_MAGIC_STRLEN) == 0)
6717ab
 		return 1;	/* Ignore swap signature, it's TuxOnIce */
6717ab
@@ -94,13 +94,13 @@ static int probe_swap(blkid_probe pr, co
6717ab
 	} else if (!memcmp(mag->magic, "SWAPSPACE2", mag->len))
6717ab
 		return swap_set_info(pr, "2");
6717ab
 
6717ab
-	return -1;
6717ab
+	return 1;
6717ab
 }
6717ab
 
6717ab
 static int probe_swsuspend(blkid_probe pr, const struct blkid_idmag *mag)
6717ab
 {
6717ab
 	if (!mag)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	if (!memcmp(mag->magic, "S1SUSPEND", mag->len))
6717ab
 		return swap_set_info(pr, "s1suspend");
6717ab
 	if (!memcmp(mag->magic, "S2SUSPEND", mag->len))
6717ab
@@ -112,7 +112,7 @@ static int probe_swsuspend(blkid_probe p
6717ab
 	if (!memcmp(mag->magic, "LINHIB0001", mag->len))
6717ab
 		return swap_set_info(pr, "linhib0001");
6717ab
 
6717ab
-	return -1;	/* no signature detected */
6717ab
+	return 1;	/* no signature detected */
6717ab
 }
6717ab
 
6717ab
 const struct blkid_idinfo swap_idinfo =
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/sysv.c.kzak util-linux-2.23.2/libblkid/src/superblocks/sysv.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/sysv.c.kzak	2013-04-08 17:55:40.261856245 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/sysv.c	2014-03-28 15:11:44.683552047 +0100
6717ab
@@ -80,7 +80,7 @@ static int probe_xenix(blkid_probe pr, c
6717ab
 
6717ab
 	sb = blkid_probe_get_sb(pr, mag, struct xenix_super_block);
6717ab
 	if (!sb)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 	blkid_probe_set_label(pr, sb->s_fname, sizeof(sb->s_fname));
6717ab
 	return 0;
6717ab
 }
6717ab
@@ -105,21 +105,21 @@ static int probe_sysv(blkid_probe pr,
6717ab
 					off,
6717ab
 					sizeof(struct sysv_super_block));
6717ab
 		if (!sb)
6717ab
-			return -1;
6717ab
+			return errno ? -errno : 1;
6717ab
 
6717ab
 		if (sb->s_magic == cpu_to_le32(0xfd187e20) ||
6717ab
 		    sb->s_magic == cpu_to_be32(0xfd187e20)) {
6717ab
 
6717ab
 			if (blkid_probe_set_label(pr, sb->s_fname,
6717ab
 						sizeof(sb->s_fname)))
6717ab
-				return -1;
6717ab
+				return 1;
6717ab
 
6717ab
 			if (blkid_probe_set_magic(pr,
6717ab
 					off + offsetof(struct sysv_super_block,
6717ab
 								s_magic),
6717ab
 					sizeof(sb->s_magic),
6717ab
 					(unsigned char *) &sb->s_magic))
6717ab
-				return -1;
6717ab
+				return 1;
6717ab
 
6717ab
 			return 0;
6717ab
 		}
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/ubifs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/ubifs.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/ubifs.c.kzak	2013-06-13 09:46:10.426650673 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/ubifs.c	2014-03-28 15:11:44.683552047 +0100
6717ab
@@ -99,7 +99,7 @@ static int probe_ubifs(blkid_probe pr, c
6717ab
 
6717ab
 	sb = blkid_probe_get_sb(pr, mag, struct ubifs_sb_node);
6717ab
 	if (!sb)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	blkid_probe_set_uuid(pr, sb->uuid);
6717ab
 	blkid_probe_sprintf_version(pr, "w%dr%d",
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/udf.c.kzak util-linux-2.23.2/libblkid/src/superblocks/udf.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/udf.c.kzak	2013-06-13 09:46:10.426650673 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/udf.c	2014-03-28 15:11:44.683552047 +0100
6717ab
@@ -85,11 +85,11 @@ static int probe_udf(blkid_probe pr,
6717ab
 					UDF_VSD_OFFSET + b,
6717ab
 					sizeof(*vsd));
6717ab
 		if (!vsd)
6717ab
-			return 1;
6717ab
+			return errno ? -errno : 1;
6717ab
 		if (vsd->id[0] != '\0')
6717ab
 			goto nsr;
6717ab
 	}
6717ab
-	return -1;
6717ab
+	return 1;
6717ab
 
6717ab
 nsr:
6717ab
 	/* search the list of VSDs for a NSR descriptor */
6717ab
@@ -99,15 +99,15 @@ nsr:
6717ab
 					UDF_VSD_OFFSET + ((blkid_loff_t) b * 0x800),
6717ab
 					sizeof(*vsd));
6717ab
 		if (!vsd)
6717ab
-			return -1;
6717ab
+			return errno ? -errno : 1;
6717ab
 		if (vsd->id[0] == '\0')
6717ab
-			return -1;
6717ab
+			return 1;
6717ab
 		if (memcmp(vsd->id, "NSR02", 5) == 0)
6717ab
 			goto anchor;
6717ab
 		if (memcmp(vsd->id, "NSR03", 5) == 0)
6717ab
 			goto anchor;
6717ab
 	}
6717ab
-	return -1;
6717ab
+	return 1;
6717ab
 
6717ab
 anchor:
6717ab
 	/* read Anchor Volume Descriptor (AVDP), checking block size */
6717ab
@@ -115,7 +115,7 @@ anchor:
6717ab
 		vd = (struct volume_descriptor *)
6717ab
 			blkid_probe_get_buffer(pr, 256 * pbs[i], sizeof(*vd));
6717ab
 		if (!vd)
6717ab
-			return -1;
6717ab
+			return errno ? -errno : 1;
6717ab
 
6717ab
 		type = le16_to_cpu(vd->tag.id);
6717ab
 		if (type == 2) /* TAG_ID_AVDP */
6717ab
@@ -138,7 +138,7 @@ real_blksz:
6717ab
 					(blkid_loff_t) (loc + b) * bs,
6717ab
 					sizeof(*vd));
6717ab
 		if (!vd)
6717ab
-			return -1;
6717ab
+			return errno ? -errno : 1;
6717ab
 	}
6717ab
 
6717ab
 	/* Try extract all possible ISO9660 information -- if there is
6717ab
@@ -155,7 +155,7 @@ real_blksz:
6717ab
 					(blkid_loff_t) (loc + b) * bs,
6717ab
 					sizeof(*vd));
6717ab
 		if (!vd)
6717ab
-			return -1;
6717ab
+			return errno ? -errno : 1;
6717ab
 		type = le16_to_cpu(vd->tag.id);
6717ab
 		if (type == 0)
6717ab
 			break;
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/ufs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/ufs.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/ufs.c.kzak	2013-04-08 17:55:40.263856264 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/ufs.c	2014-03-28 15:11:44.683552047 +0100
6717ab
@@ -185,7 +185,7 @@ static int probe_ufs(blkid_probe pr,
6717ab
 					offsets[i] * 1024,
6717ab
 					sizeof(struct ufs_super_block));
6717ab
 		if (!ufs)
6717ab
-			return -1;
6717ab
+			return errno ? -errno : 1;
6717ab
 
6717ab
 		magBE = be32_to_cpu(ufs->fs_magic);
6717ab
 		magLE = le32_to_cpu(ufs->fs_magic);
6717ab
@@ -231,7 +231,7 @@ found:
6717ab
 				offsetof(struct ufs_super_block, fs_magic),
6717ab
 			sizeof(ufs->fs_magic),
6717ab
 			(unsigned char *) &ufs->fs_magic))
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 
6717ab
 	return 0;
6717ab
 }
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/vfat.c.kzak util-linux-2.23.2/libblkid/src/superblocks/vfat.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/vfat.c.kzak	2013-06-13 09:46:10.426650673 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/vfat.c	2014-03-28 15:12:28.036993622 +0100
6717ab
@@ -255,16 +255,20 @@ int blkid_probe_is_vfat(blkid_probe pr)
6717ab
 	struct vfat_super_block *vs;
6717ab
 	struct msdos_super_block *ms;
6717ab
 	const struct blkid_idmag *mag = NULL;
6717ab
+	int rc;
6717ab
 
6717ab
-	if (blkid_probe_get_idmag(pr, &vfat_idinfo, NULL, &mag) || !mag)
6717ab
+	rc = blkid_probe_get_idmag(pr, &vfat_idinfo, NULL, &mag;;
6717ab
+	if (rc < 0)
6717ab
+		return rc;	/* error */
6717ab
+	if (rc != BLKID_PROBE_OK || !mag)
6717ab
 		return 0;
6717ab
 
6717ab
 	ms = blkid_probe_get_sb(pr, mag, struct msdos_super_block);
6717ab
 	if (!ms)
6717ab
-		return 0;
6717ab
+		return errno ? -errno : 0;
6717ab
 	vs = blkid_probe_get_sb(pr, mag, struct vfat_super_block);
6717ab
 	if (!vs)
6717ab
-		return 0;
6717ab
+		return errno ? -errno : 0;
6717ab
 
6717ab
 	return fat_valid_superblock(mag, ms, vs, NULL, NULL);
6717ab
 }
6717ab
@@ -283,10 +287,12 @@ static int probe_vfat(blkid_probe pr, co
6717ab
 
6717ab
 	ms = blkid_probe_get_sb(pr, mag, struct msdos_super_block);
6717ab
 	if (!ms)
6717ab
-		return 0;
6717ab
+		return errno ? -errno : 1;
6717ab
+
6717ab
 	vs = blkid_probe_get_sb(pr, mag, struct vfat_super_block);
6717ab
 	if (!vs)
6717ab
-		return 0;
6717ab
+		return errno ? -errno : 1;
6717ab
+
6717ab
 	if (!fat_valid_superblock(mag, ms, vs, &cluster_count, &fat_size))
6717ab
 		return 1;
6717ab
 
6717ab
@@ -376,16 +382,16 @@ static int probe_vfat(blkid_probe pr, co
6717ab
 					(blkid_loff_t) fsinfo_sect * sector_size,
6717ab
 					sizeof(struct fat32_fsinfo));
6717ab
 			if (buf == NULL)
6717ab
-				return -1;
6717ab
+				return errno ? -errno : 1;
6717ab
 
6717ab
 			fsinfo = (struct fat32_fsinfo *) buf;
6717ab
 			if (memcmp(fsinfo->signature1, "\x52\x52\x61\x41", 4) != 0 &&
6717ab
 			    memcmp(fsinfo->signature1, "\x52\x52\x64\x41", 4) != 0 &&
6717ab
 			    memcmp(fsinfo->signature1, "\x00\x00\x00\x00", 4) != 0)
6717ab
-				return -1;
6717ab
+				return 1;
6717ab
 			if (memcmp(fsinfo->signature2, "\x72\x72\x41\x61", 4) != 0 &&
6717ab
 			    memcmp(fsinfo->signature2, "\x00\x00\x00\x00", 4) != 0)
6717ab
-				return -1;
6717ab
+				return 1;
6717ab
 		}
6717ab
 	}
6717ab
 
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/via_raid.c.kzak util-linux-2.23.2/libblkid/src/superblocks/via_raid.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/via_raid.c.kzak	2013-04-08 17:55:40.264856273 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/via_raid.c	2014-03-28 15:11:44.683552047 +0100
6717ab
@@ -52,9 +52,9 @@ static int probe_viaraid(blkid_probe pr,
6717ab
 	struct via_metadata *v;
6717ab
 
6717ab
 	if (pr->size < 0x10000)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 
6717ab
 	off = ((pr->size / 0x200)-1) * 0x200;
6717ab
 
6717ab
@@ -63,19 +63,19 @@ static int probe_viaraid(blkid_probe pr,
6717ab
 				off,
6717ab
 				sizeof(struct via_metadata));
6717ab
 	if (!v)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 	if (le16_to_cpu(v->signature) != VIA_SIGNATURE)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	if (v->version_number > 2)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	if (!via_checksum(v))
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	if (blkid_probe_sprintf_version(pr, "%u", v->version_number) != 0)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	if (blkid_probe_set_magic(pr, off,
6717ab
 				sizeof(v->signature),
6717ab
 				(unsigned char *) &v->signature))
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 	return 0;
6717ab
 }
6717ab
 
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/vmfs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/vmfs.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/vmfs.c.kzak	2013-04-08 17:55:40.264856273 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/vmfs.c	2014-03-28 15:11:44.683552047 +0100
6717ab
@@ -28,7 +28,7 @@ static int probe_vmfs_fs(blkid_probe pr,
6717ab
 
6717ab
 	header = blkid_probe_get_sb(pr, mag, struct vmfs_fs_info);
6717ab
 	if (header == NULL)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	blkid_probe_sprintf_uuid(pr, (unsigned char *) header->uuid, 16,
6717ab
 		"%02x%02x%02x%02x-%02x%02x%02x%02x-"
6717ab
@@ -53,7 +53,7 @@ static int probe_vmfs_volume(blkid_probe
6717ab
 
6717ab
 	header = blkid_probe_get_sb(pr, mag, struct vmfs_volume_info);
6717ab
 	if (header == NULL)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	blkid_probe_sprintf_value(pr, "UUID_SUB",
6717ab
 		"%02x%02x%02x%02x-%02x%02x%02x%02x-"
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/vxfs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/vxfs.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/vxfs.c.kzak	2013-04-08 17:55:40.264856273 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/vxfs.c	2014-03-28 15:11:44.683552047 +0100
6717ab
@@ -20,7 +20,7 @@ static int probe_vxfs(blkid_probe pr, co
6717ab
 
6717ab
 	vxs = blkid_probe_get_sb(pr, mag, struct vxfs_super_block);
6717ab
 	if (!vxs)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	blkid_probe_sprintf_version(pr, "%u", (unsigned int) vxs->vs_version);
6717ab
 	return 0;
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/xfs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/xfs.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/xfs.c.kzak	2013-04-08 17:55:40.265856283 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/xfs.c	2014-03-28 15:11:44.683552047 +0100
6717ab
@@ -40,7 +40,7 @@ static int probe_xfs(blkid_probe pr, con
6717ab
 
6717ab
 	xs = blkid_probe_get_sb(pr, mag, struct xfs_super_block);
6717ab
 	if (!xs)
6717ab
-		return -1;
6717ab
+		return errno ? -errno : 1;
6717ab
 
6717ab
 	if (strlen(xs->xs_fname))
6717ab
 		blkid_probe_set_label(pr, (unsigned char *) xs->xs_fname,
6717ab
diff -up util-linux-2.23.2/libblkid/src/superblocks/zfs.c.kzak util-linux-2.23.2/libblkid/src/superblocks/zfs.c
6717ab
--- util-linux-2.23.2/libblkid/src/superblocks/zfs.c.kzak	2013-06-13 09:46:10.427650682 +0200
6717ab
+++ util-linux-2.23.2/libblkid/src/superblocks/zfs.c	2014-03-28 15:11:44.683552047 +0100
6717ab
@@ -185,7 +185,7 @@ static int probe_zfs(blkid_probe pr,
6717ab
 			blkid_probe_get_buffer(pr, offset,
6717ab
 					       sizeof(struct zfs_uberblock));
6717ab
 		if (ub == NULL)
6717ab
-			return -1;
6717ab
+			return errno ? -errno : 1;
6717ab
 
6717ab
 		if (ub->ub_magic == UBERBLOCK_MAGIC) {
6717ab
 			ub_offset = offset;
6717ab
@@ -202,7 +202,7 @@ static int probe_zfs(blkid_probe pr,
6717ab
 	}
6717ab
 
6717ab
 	if (found < 4)
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 
6717ab
 	/* If we found the 4th uberblock, then we will have exited from the
6717ab
 	 * scanning loop immediately, and ub will be a valid uberblock. */
6717ab
@@ -214,7 +214,7 @@ static int probe_zfs(blkid_probe pr,
6717ab
 	if (blkid_probe_set_magic(pr, ub_offset,
6717ab
 				sizeof(ub->ub_magic),
6717ab
 				(unsigned char *) &ub->ub_magic))
6717ab
-		return -1;
6717ab
+		return 1;
6717ab
 
6717ab
 	return 0;
6717ab
 }