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