]> err.no Git - util-linux/commitdiff
blkid: cleanup debug messages and return codes in blkid_do_probe()
authorKarel Zak <kzak@redhat.com>
Thu, 14 May 2009 18:28:11 +0000 (20:28 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 14 May 2009 18:28:11 +0000 (20:28 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
shlibs/blkid/src/probe.c

index af22e34dacaf9a00dd5041e4d60716fbfa265e76..38d42762f2726da784def72fdd000712be8721fe 100644 (file)
@@ -453,17 +453,16 @@ int blkid_do_probe(blkid_probe pr)
 {
        int i = 0;
 
-       if (!pr)
+       if (!pr || pr->idx < -1)
                return -1;
 
        blkid_probe_reset_vals(pr);
 
-       i = pr->idx + 1;
+       DBG(DEBUG_LOWPROBE,
+               printf("--> starting probing loop [idx=%d]\n",
+               pr->idx));
 
-       if (i < 0 && i >= ARRAY_SIZE(idinfos))
-               return -1;
-
-       DBG(DEBUG_LOWPROBE, printf("--> starting probing loop\n"));
+       i = pr->idx + 1;
 
        for ( ; i < ARRAY_SIZE(idinfos); i++) {
                const struct blkid_idinfo *id;
@@ -518,10 +517,13 @@ int blkid_do_probe(blkid_probe pr)
                        blkid_probe_set_usage(pr, id->usage);
 
                DBG(DEBUG_LOWPROBE,
-                       printf("<-- leaving probing loop (type=%s)\n", id->name));
+                       printf("<-- leaving probing loop (type=%s) [idx=%d]\n",
+                       id->name, pr->idx));
                return 0;
        }
-       DBG(DEBUG_LOWPROBE, printf("<-- leaving probing loop (failed)\n"));
+       DBG(DEBUG_LOWPROBE,
+               printf("<-- leaving probing loop (failed) [idx=%d]\n",
+               pr->idx));
        return 1;
 }