summaryrefslogtreecommitdiffstats
path: root/shlibs/blkid/src/probe.c
diff options
context:
space:
mode:
authorKarel Zak2010-09-15 11:51:09 +0200
committerKarel Zak2010-09-15 11:51:09 +0200
commit26eb5a59fc0e7e1f3e6493c647f8b7071af9b31a (patch)
tree9bbf4103af638c2cd74ad92f7340af060a00af2e /shlibs/blkid/src/probe.c
parentmount: better describe UUIDs usage in man pages (diff)
downloadkernel-qcow2-util-linux-26eb5a59fc0e7e1f3e6493c647f8b7071af9b31a.tar.gz
kernel-qcow2-util-linux-26eb5a59fc0e7e1f3e6493c647f8b7071af9b31a.tar.xz
kernel-qcow2-util-linux-26eb5a59fc0e7e1f3e6493c647f8b7071af9b31a.zip
libblkid: don't probe directories
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'shlibs/blkid/src/probe.c')
-rw-r--r--shlibs/blkid/src/probe.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/shlibs/blkid/src/probe.c b/shlibs/blkid/src/probe.c
index 200a52c5e..9353ecd2e 100644
--- a/shlibs/blkid/src/probe.c
+++ b/shlibs/blkid/src/probe.c
@@ -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;