summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Andree <matthias.andree@gmx.de>2006-05-30 04:26:13 +0200
committerMatthias Andree <matthias.andree@gmx.de>2006-05-30 04:26:13 +0200
commit5beaabb0f88e3fb2a4b3617fed9ac76f7a60f440 (patch)
tree42116e0ab8d0a5e8b05a6681d504f0db73936cc8
parent12a829dcdc57fb8ddc4887b07b40136288b6e7fe (diff)
downloade2fsprogs-5beaabb0f88e3fb2a4b3617fed9ac76f7a60f440.tar.gz
Enable sys/disklabel.h and DIOCGDINFO based getsize code.
Tested on FreeBSD 4.11-RELEASE i386. Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
-rw-r--r--lib/blkid/getsize.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/blkid/getsize.c b/lib/blkid/getsize.c
index 5525d19b..6639246c 100644
--- a/lib/blkid/getsize.c
+++ b/lib/blkid/getsize.c
@@ -133,13 +133,13 @@ blkid_loff_t blkid_get_dev_size(int fd)
return (blkid_loff_t)this_floppy.size << 9;
#endif
#ifdef HAVE_SYS_DISKLABEL_H
-#if 0
+#if 1
/*
* This should work in theory but I haven't tested it. Anyone
* on a BSD system want to test this for me? In the meantime,
* binary search mechanism should work just fine.
*/
- if ((fstat(fd, &st) >= 0) && S_ISBLK(st.st_mode))
+ if ((fstat(fd, &st) >= 0) && (S_ISBLK(st.st_mode) || S_ISCHR(st.st_mode)))
part = st.st_rdev & 7;
if (part >= 0 && (ioctl(fd, DIOCGDINFO, (char *)&lab) >= 0)) {
pp = &lab.d_partitions[part];