Support lseek64.
authorVladimir Serbinenko <phcoder@gmail.com>
Mon, 23 Jan 2017 17:21:05 +0000 (20:21 +0300)
committerVladimir Serbinenko <phcoder@gmail.com>
Wed, 3 May 2017 10:24:43 +0000 (12:24 +0200)
Android doesn't have 64-bit off_t, so use off64_t instead.

configure.ac
grub-core/osdep/unix/hostdisk.c

index d10d8ad..e0262e1 100644 (file)
@@ -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
index 2a8c588..5450cf4 100644 (file)
@@ -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;
 }