From d75bcac49ac500e4bf3fd7297f22ae9a2133f0eb Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 31 Jan 2012 14:19:27 +0100 Subject: [PATCH] blkid: check fd before use [coverity scan] Signed-off-by: Karel Zak --- misc-utils/blkid.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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); -- 2.47.3