libblkid: don't probe directories

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2010-09-15 11:51:09 +02:00
parent 7c97f7402e
commit 26eb5a59fc
1 changed files with 3 additions and 0 deletions

View 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;