From: Karel Zak Date: Tue, 31 Jan 2012 13:19:27 +0000 (+0100) Subject: blkid: check fd before use [coverity scan] X-Git-Tag: v2.21-rc2~57 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d75bcac49ac500e4bf3fd7297f22ae9a2133f0eb;p=thirdparty%2Futil-linux.git blkid: check fd before use [coverity scan] Signed-off-by: Karel Zak --- diff --git a/misc-utils/blkid.c b/misc-utils/blkid.c index 463fad3c0d..e0009a5684 100644 --- a/misc-utils/blkid.c +++ b/misc-utils/blkid.c @@ -448,9 +448,9 @@ done: static int lowprobe_superblocks(blkid_probe pr) { struct stat st; - int rc; + int rc, fd = blkid_probe_get_fd(pr); - if (fstat(blkid_probe_get_fd(pr), &st)) + if (fd < 0 || fstat(fd, &st)) return -1; blkid_probe_enable_partitions(pr, 1);