cdown / rpms / util-linux

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