Support lseek64.

Android doesn't have 64-bit off_t, so use off64_t instead.
This commit is contained in:
Vladimir Serbinenko 2017-01-23 20:21:05 +03:00
parent 6dec3a26b3
commit 608bec5112
2 changed files with 12 additions and 1 deletions

View 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

View 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;
}