summaryrefslogtreecommitdiff
path: root/lib/blkid/devname.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2017-08-28 18:04:11 -0400
committerTheodore Ts'o <tytso@mit.edu>2017-08-28 18:17:26 -0400
commitf61aa76e456567b622cb0b6e5eb33de394600948 (patch)
treeceb79ff064bf5fb6b3b140dc86147c10a05b648b /lib/blkid/devname.c
parent3242252453a9088ca0f54161bd8d7fd32dff9591 (diff)
downloade2fsprogs-f61aa76e456567b622cb0b6e5eb33de394600948.tar.gz
Fix FreeBSD portability problem caused by it using character mode disk devices
We were using S_ISBLK() to test if a device could be used as a disk device. This doesn't work for FreeBSD. We need to test for S_ISBLK() || S_ISCHR(). Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'lib/blkid/devname.c')
-rw-r--r--lib/blkid/devname.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/blkid/devname.c b/lib/blkid/devname.c
index 671e781f..f3956da7 100644
--- a/lib/blkid/devname.c
+++ b/lib/blkid/devname.c
@@ -231,7 +231,8 @@ static void probe_one(blkid_cache cache, const char *ptname,
dev->bid_devno == devno)
goto set_pri;
- if (stat(device, &st) == 0 && S_ISBLK(st.st_mode) &&
+ if (stat(device, &st) == 0 &&
+ blkidP_is_disk_device(st.st_mode) &&
st.st_rdev == devno) {
devname = blkid_strdup(device);
goto get_dev;