From f7f1de581a7933e4a791793e267036c35ae52da3 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 14 May 2009 20:28:11 +0200 Subject: [PATCH] blkid: cleanup debug messages and return codes in blkid_do_probe() Signed-off-by: Karel Zak --- libs/blkid/src/probe.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/libs/blkid/src/probe.c b/libs/blkid/src/probe.c index af22e34d..38d42762 100644 --- a/libs/blkid/src/probe.c +++ b/libs/blkid/src/probe.c @@ -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; } -- 2.39.5