aboutsummaryrefslogtreecommitdiff
path: root/lib/lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/lib.c')
-rw-r--r--lib/lib.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/lib.c b/lib/lib.c
index 2a4cd8c5..2ac5c74c 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -478,14 +478,11 @@ off_t fdlength(int fd)
if (!fstat(fd, &st) && S_ISREG(st.st_mode)) return st.st_size;
// If the ioctl works for this, return it.
- if (ioctl(fd, BLKGETSIZE64, &size) >= 0) return size<<9;
+ if (get_block_device_size(fd, &size)) return size<<9;
// If not, do a binary search for the last location we can read. (Some
// block devices don't do BLKGETSIZE right.) This should probably have
// a CONFIG option...
-
- // If not, do a binary search for the last location we can read.
-
old = lseek(fd, 0, SEEK_CUR);
do {
char temp;