]> err.no Git - util-linux/commitdiff
libblkid: don't probe directories
authorKarel Zak <kzak@redhat.com>
Wed, 15 Sep 2010 09:51:09 +0000 (11:51 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 15 Sep 2010 09:51:09 +0000 (11:51 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
shlibs/blkid/src/probe.c

index 200a52c5e756c56afcc53d49c4a379bc22c364db..9353ecd2e8382da5c8571d102f11acfe1b44bb6a 100644 (file)
@@ -626,6 +626,9 @@ int blkid_probe_set_device(blkid_probe pr, int fd,
        if (fstat(fd, &sb))
                goto err;
 
+       if (!S_ISBLK(sb.st_mode) && !S_ISCHR(sb.st_mode) && !S_ISREG(sb.st_mode))
+               goto err;
+
        pr->mode = sb.st_mode;
        if (S_ISBLK(sb.st_mode) || S_ISCHR(sb.st_mode))
                pr->devno = sb.st_rdev;