diff options
author | Elliott Hughes <enh@google.com> | 2020-03-10 09:18:22 -0700 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2020-03-11 09:40:00 -0500 |
commit | e400e605471a5bc6571623b4446c41bfc9eb4942 (patch) | |
tree | 1dc99958bfac5e57865b211b3118515393107b90 /lib/lib.c | |
parent | e6b3ac496f8b72f089247e93e6892bb6fa094976 (diff) | |
download | toybox-e400e605471a5bc6571623b4446c41bfc9eb4942.tar.gz |
Fix Mac build.
The recent re-enablement of the BLKGETSIZE64 code broke the Mac
build. Use the equivalent <sys/disk.h> ioctl() pair instead.
Diffstat (limited to 'lib/lib.c')
-rw-r--r-- | lib/lib.c | 5 |
1 files changed, 1 insertions, 4 deletions
@@ -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; |