summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac27
-rw-r--r--src/Makefile.am10
-rw-r--r--src/libirecovery.c6
3 files changed, 38 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac
index d7aafbf..7a28800 100644
--- a/configure.ac
+++ b/configure.ac
@@ -95,6 +95,33 @@ case "$GLOBAL_CFLAGS" in
AC_DEFINE([HAVE_FVISIBILITY], [1], [Define if compiled with -fvisibility=hidden])
esac
+# check for large file support
+AC_SYS_LARGEFILE
+LFS_CFLAGS=''
+if test "$enable_largefile" != no; then
+ if test "$ac_cv_sys_file_offset_bits" != 'no'; then
+ LFS_CFLAGS="$LFS_CFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
+ else
+ AC_MSG_CHECKING(for native large file support)
+ AC_RUN_IFELSE([AC_LANG_SOURCE([#include <unistd.h>
+ int main (int argc, char **argv)
+ {
+ exit(!(sizeof(off_t) == 8));
+ }])],
+ [ac_cv_sys_file_offset_bits=64; AC_DEFINE(_FILE_OFFSET_BITS,64)
+ AC_MSG_RESULT(yes)],
+ [AC_MSG_RESULT(no)])
+ fi
+ if test "$ac_cv_sys_large_files" != 'no'; then
+ LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES=1"
+ fi
+ AC_FUNC_FSEEKO
+ if test "$ac_cv_sys_largefile_source" != 'no'; then
+ LFS_CFLAGS="$LFS_CFLAGS -D_LARGEFILE_SOURCE=1"
+ fi
+fi
+AC_SUBST(LFS_CFLAGS)
+
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
AC_OUTPUT([
diff --git a/src/Makefile.am b/src/Makefile.am
index 4316454..73ae945 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,7 +1,13 @@
AM_CPPFLAGS = -I$(top_srcdir)/include
-AM_CFLAGS = $(GLOBAL_CFLAGS) $(libusb_CFLAGS)
-AM_LDFLAGS = $(libusb_LIBS) $(LIBIRECOVERYLDFLAGS)
+AM_CFLAGS = \
+ $(GLOBAL_CFLAGS) \
+ $(LFS_CFLAGS) \
+ $(libusb_CFLAGS)
+
+AM_LDFLAGS = \
+ $(libusb_LIBS) \
+ $(LIBIRECOVERYLDFLAGS)
lib_LTLIBRARIES = libirecovery.la
libirecovery_la_CFLAGS = $(AM_CFLAGS)
diff --git a/src/libirecovery.c b/src/libirecovery.c
index d632b63..fa0f417 100644
--- a/src/libirecovery.c
+++ b/src/libirecovery.c
@@ -1129,9 +1129,9 @@ IRECV_API irecv_error_t irecv_send_file(irecv_client_t client, const char* filen
return IRECV_E_FILE_NOT_FOUND;
}
- fseek(file, 0, SEEK_END);
- long length = ftell(file);
- fseek(file, 0, SEEK_SET);
+ fseeko(file, 0, SEEK_END);
+ long length = ftello(file);
+ fseeko(file, 0, SEEK_SET);
char* buffer = (char*) malloc(length);
if (buffer == NULL) {