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	2015-08-11 14:00:27.930573965 +0200
531551
+++ util-linux-2.23.2/libblkid/src/partitions/partitions.c	2015-08-11 14:13:11.213087814 +0200
531551
@@ -533,7 +533,7 @@ static int idinfo_probe(blkid_probe pr,
531551
 {
531551
 	const struct blkid_idmag *mag = NULL;
531551
 	blkid_loff_t off;
531551
-	int rc = BLKID_PROBE_NONE;		/* = nothing detected */
531551
+	int rc = BLKID_PROBE_NONE;		/* default is nothing */
531551
 
531551
 	if (pr->size <= 0 || (id->minsz && id->minsz > pr->size))
531551
 		goto nothing;	/* the device is too small */
531551
@@ -564,8 +564,10 @@ static int idinfo_probe(blkid_probe pr,
531551
 		DBG(LOWPROBE, blkid_debug("%s: <--- (rc = %d)", id->name, rc));
531551
 	}
531551
 
531551
-nothing:
531551
 	return rc;
531551
+
531551
+nothing:
531551
+	return BLKID_PROBE_NONE;
531551
 }
531551
 
531551
 /*
531551
@@ -620,7 +622,7 @@ static int partitions_probe(blkid_probe
531551
 						strlen(name) + 1);
531551
 		DBG(LOWPROBE, blkid_debug("<-- leaving probing loop (type=%s) [PARTS idx=%d]",
531551
 			name, chn->idx));
531551
-		rc = 0;
531551
+		rc = BLKID_PROBE_OK;
531551
 		break;
531551
 	}
531551
 
531551
@@ -637,10 +639,16 @@ details_only:
531551
 	    (blkid_partitions_get_flags(pr) & BLKID_PARTS_ENTRY_DETAILS)) {
531551
 
531551
 		int xrc = blkid_partitions_probe_partition(pr);
531551
+
531551
+		/* partition entry probing is optional, and "not-found" from
531551
+		 * this sub-probing must not to overwrite previous success. */
531551
 		if (xrc < 0)
531551
-			rc = xrc;	/* optional, care about errors only */
531551
+			rc = xrc;			/* always propagate errors */
531551
+		else if (rc == BLKID_PROBE_NONE)
531551
+			rc = xrc;
531551
 	}
531551
 
531551
+	DBG(LOWPROBE, blkid_debug("partitions probe done [rc=%d]", rc));
531551
 	return rc;
531551
 }
531551
 
531551
@@ -709,7 +717,6 @@ int blkid_partitions_do_subprobe(blkid_p
531551
 
531551
 static int blkid_partitions_probe_partition(blkid_probe pr)
531551
 {
531551
-	int rc = BLKID_PROBE_NONE;
531551
 	blkid_probe disk_pr = NULL;
531551
 	blkid_partlist ls;
531551
 	blkid_partition par;
531551
@@ -732,7 +739,9 @@ static int blkid_partitions_probe_partit
531551
 		goto nothing;
531551
 
531551
 	par = blkid_partlist_devno_to_partition(ls, devno);
531551
-	if (par) {
531551
+	if (!par)
531551
+		goto nothing;
531551
+	else {
531551
 		const char *v;
531551
 		blkid_parttable tab = blkid_partition_get_table(par);
531551
 		dev_t disk = blkid_probe_get_devno(disk_pr);
531551
@@ -778,9 +787,13 @@ 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 = BLKID_PROBE_OK;
531551
+
531551
+	DBG(LOWPROBE, blkid_debug("parts: end probing for partition entry [success]"));
531551
+	return BLKID_PROBE_OK;
531551
+
531551
 nothing:
531551
-	return rc;
531551
+	DBG(LOWPROBE, blkid_debug("parts: end probing for partition entry [nothing]"));
531551
+	return BLKID_PROBE_NONE;
531551
 }
531551
 
531551
 /*
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	2015-07-03 10:35:05.456153560 +0200
531551
+++ util-linux-2.23.2/libblkid/src/superblocks/superblocks.c	2015-08-11 14:08:42.572674469 +0200
531551
@@ -335,19 +335,24 @@ static int superblocks_probe(blkid_probe
531551
 
531551
 	if (!pr || chn->idx < -1)
531551
 		return -EINVAL;
531551
-	if (pr->flags & BLKID_FL_NOSCAN_DEV)
531551
-		goto nothing;
531551
 
531551
 	blkid_probe_chain_reset_vals(pr, chn);
531551
 
531551
 	DBG(LOWPROBE, blkid_debug("--> starting probing loop [SUBLKS idx=%d]",
531551
 		chn->idx));
531551
 
531551
+	if (pr->flags & BLKID_FL_NOSCAN_DEV)
531551
+		return BLKID_PROBE_NONE;
531551
+
531551
 	if (pr->size <= 0 || (pr->size <= 1024 && !S_ISCHR(pr->mode)))
531551
 		/* Ignore very very small block devices or regular files (e.g.
531551
 		 * extended partitions). Note that size of the UBI char devices
531551
 		 * is 1 byte */
531551
-		goto nothing;
531551
+		return BLKID_PROBE_NONE;
531551
+
531551
+
531551
+	DBG(LOWPROBE, blkid_debug("--> starting probing loop [SUBLKS idx=%d]",
531551
+		chn->idx));
531551
 
531551
 	i = chn->idx < 0 ? 0 : chn->idx + 1U;
531551
 
531551
@@ -417,7 +422,7 @@ static int superblocks_probe(blkid_probe
531551
 					(unsigned char *) mag->magic);
531551
 		if (rc) {
531551
 			blkid_probe_chain_reset_vals(pr, chn);
531551
-			DBG(LOWPROBE, blkid_debug("failed to set result -- ingnore"));
531551
+			DBG(LOWPROBE, blkid_debug("failed to set result -- ignore"));
531551
 			continue;
531551
 		}
531551
 
531551
@@ -426,7 +431,6 @@ static int superblocks_probe(blkid_probe
531551
 		return BLKID_PROBE_OK;
531551
 	}
531551
 
531551
-nothing:
531551
 	DBG(LOWPROBE, blkid_debug("<-- leaving probing loop (failed=%d) [SUBLKS idx=%d]",
531551
 			rc, chn->idx));
531551
 	return rc;
531551
@@ -454,13 +458,12 @@ static int superblocks_safeprobe(blkid_p
531551
 	int rc;
531551
 
531551
 	if (pr->flags & BLKID_FL_NOSCAN_DEV)
531551
-		return 1;				/* nothing */
531551
+		return BLKID_PROBE_NONE;
531551
 
531551
 	while ((rc = superblocks_probe(pr, chn)) == 0) {
531551
 
531551
 		if (blkid_probe_is_tiny(pr) && !count)
531551
-			/* floppy or so -- returns the first result. */
531551
-			return 0;
531551
+			return BLKID_PROBE_OK;	/* floppy or so -- returns the first result. */
531551
 
531551
 		count++;
531551
 
531551
@@ -489,7 +492,7 @@ static int superblocks_safeprobe(blkid_p
531551
 		return -2;		/* error, ambivalent result (more FS) */
531551
 	}
531551
 	if (!count)
531551
-		return 1;		/* nothing detected */
531551
+		return BLKID_PROBE_NONE;
531551
 
531551
 	if (idx != -1) {
531551
 		/* restore the first result */
531551
@@ -506,7 +509,7 @@ static int superblocks_safeprobe(blkid_p
531551
 	if (chn->idx >= 0 && idinfos[chn->idx]->usage & BLKID_USAGE_RAID)
531551
 		pr->prob_flags |= BLKID_PROBE_FL_IGNORE_PT;
531551
 
531551
-	return 0;
531551
+	return BLKID_PROBE_OK;
531551
 }
531551
 
531551
 int blkid_probe_set_version(blkid_probe pr, const char *version)
531551
diff -up util-linux-2.23.2/libblkid/src/topology/topology.c.kzak util-linux-2.23.2/libblkid/src/topology/topology.c
531551
--- util-linux-2.23.2/libblkid/src/topology/topology.c.kzak	2013-06-13 09:46:10.429650699 +0200
531551
+++ util-linux-2.23.2/libblkid/src/topology/topology.c	2015-08-11 14:09:35.623361499 +0200
531551
@@ -150,7 +150,7 @@ static int topology_probe(blkid_probe pr
531551
 		return -1;
531551
 
531551
 	if (!S_ISBLK(pr->mode))
531551
-		return -1;	/* nothing, works with block devices only */
531551
+		return -EINVAL;	/* nothing, works with block devices only */
531551
 
531551
 	if (chn->binary) {
531551
 		DBG(LOWPROBE, blkid_debug("initialize topology binary data"));
531551
@@ -163,7 +163,7 @@ static int topology_probe(blkid_probe pr
531551
 			chn->data = calloc(1,
531551
 					sizeof(struct blkid_struct_topology));
531551
 			if (!chn->data)
531551
-				return -1;
531551
+				return -ENOMEM;
531551
 		}
531551
 	}
531551
 
531551
@@ -193,12 +193,12 @@ static int topology_probe(blkid_probe pr
531551
 
531551
 		DBG(LOWPROBE, blkid_debug("<-- leaving probing loop (type=%s) [TOPOLOGY idx=%d]",
531551
 			id->name, chn->idx));
531551
-		return 0;
531551
+		return BLKID_PROBE_OK;
531551
 	}
531551
 
531551
 	DBG(LOWPROBE, blkid_debug("<-- leaving probing loop (failed) [TOPOLOGY idx=%d]",
531551
 		chn->idx));
531551
-	return 1;
531551
+	return BLKID_PROBE_NONE;
531551
 }
531551
 
531551
 static void topology_free(blkid_probe pr __attribute__((__unused__)),