From: Petr Uzel Date: Thu, 17 May 2012 07:37:25 +0000 (+0200) Subject: blkid: stop device probing if error is detected X-Git-Tag: v2.22-rc1~388 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=078ad9bf06568b38767ac2049371e628373c0ef8;p=thirdparty%2Futil-linux.git blkid: stop device probing if error is detected blkid -p dev1 dev2 [...] now stops upon first error detected and returns correct value. Previously, if error was detected with dev1, it continued with dev2 anyways and so the return value corresponded to the last device only. Reported-by: Bernhard Voelker Signed-off-by: Petr Uzel --- diff --git a/misc-utils/blkid.c b/misc-utils/blkid.c index 52b2a4bc9d..25e6c00e8e 100644 --- a/misc-utils/blkid.c +++ b/misc-utils/blkid.c @@ -868,11 +868,14 @@ int main(int argc, char **argv) goto exit; } - for (i = 0; i < numdev; i++) + for (i = 0; i < numdev; i++) { err = lowprobe_device(pr, devices[i], lowprobe, show, output_format, (blkid_loff_t) offset, (blkid_loff_t) size); + if (err) + break; + } blkid_free_probe(pr); } else if (eval) { /*