From 608bec51128008afb81c9e3f297283e9f830a146 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 23 Jan 2017 20:21:05 +0300 Subject: [PATCH 006/206] Support lseek64. Android doesn't have 64-bit off_t, so use off64_t instead. --- configure.ac | 5 ++++- grub-core/osdep/unix/hostdisk.c | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index d10d8adac58..e0262e159f0 100644 --- a/configure.ac +++ b/configure.ac @@ -373,7 +373,10 @@ case "$host_os" in ;; *) AC_CHECK_SIZEOF(off_t) - test x"$ac_cv_sizeof_off_t" = x8 || AC_MSG_ERROR([Large file support is required]);; + if test x"$ac_cv_sizeof_off_t" != x8 ; then + AC_CHECK_SIZEOF(off64_t) + test x"$ac_cv_sizeof_off64_t" = x8 || AC_MSG_ERROR([Large file support is required]) + fi;; esac if test x$USE_NLS = xno; then diff --git a/grub-core/osdep/unix/hostdisk.c b/grub-core/osdep/unix/hostdisk.c index 2a8c5882e3d..5450cf4166e 100644 --- a/grub-core/osdep/unix/hostdisk.c +++ b/grub-core/osdep/unix/hostdisk.c @@ -77,11 +77,19 @@ grub_util_get_fd_size (grub_util_fd_t fd, const char *name, unsigned *log_secsiz int grub_util_fd_seek (grub_util_fd_t fd, grub_uint64_t off) { +#if SIZEOF_OFF_T == 8 off_t offset = (off_t) off; if (lseek (fd, offset, SEEK_SET) != offset) return -1; +#elif SIZEOF_OFF64_T == 8 + off64_t offset = (off64_t) off; + if (lseek64 (fd, offset, SEEK_SET) != offset) + return -1; +#else +#error "No large file support" +#endif return 0; } -- 2.15.0