]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
blkid: check fd before use [coverity scan]
authorKarel Zak <kzak@redhat.com>
Tue, 31 Jan 2012 13:19:27 +0000 (14:19 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 31 Jan 2012 13:19:27 +0000 (14:19 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/blkid.c

index 463fad3c0d37f8b07c0616bc6376c43f7612e5b7..e0009a5684023c1fee3152cda23e6b597fe8bcfc 100644 (file)
@@ -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);