diff options
author | Ethan Yonker <dees_troy@teamw.in> | 2014-12-10 18:40:43 +0100 |
---|---|---|
committer | Ethan Yonker <dees_troy@teamw.in> | 2014-12-10 18:54:02 +0100 |
commit | 738be7a3ffec0a4053478d49821c7da9c5fd9ee6 (patch) | |
tree | 1c8efbf90b4045d41f7664b0b88a75cff545a729 /minzip | |
parent | crypto: fix build in < 5.0 tree (diff) | |
download | android_bootable_recovery-738be7a3ffec0a4053478d49821c7da9c5fd9ee6.tar android_bootable_recovery-738be7a3ffec0a4053478d49821c7da9c5fd9ee6.tar.gz android_bootable_recovery-738be7a3ffec0a4053478d49821c7da9c5fd9ee6.tar.bz2 android_bootable_recovery-738be7a3ffec0a4053478d49821c7da9c5fd9ee6.tar.lz android_bootable_recovery-738be7a3ffec0a4053478d49821c7da9c5fd9ee6.tar.xz android_bootable_recovery-738be7a3ffec0a4053478d49821c7da9c5fd9ee6.tar.zst android_bootable_recovery-738be7a3ffec0a4053478d49821c7da9c5fd9ee6.zip |
Diffstat (limited to 'minzip')
-rw-r--r-- | minzip/Android.mk | 2 | ||||
-rw-r--r-- | minzip/SysUtil.c | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/minzip/Android.mk b/minzip/Android.mk index 68485abe1..6cca09239 100644 --- a/minzip/Android.mk +++ b/minzip/Android.mk @@ -14,6 +14,8 @@ LOCAL_C_INCLUDES := \ LOCAL_STATIC_LIBRARIES := libselinux +LOCAL_CFLAGS += -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION) + LOCAL_MODULE := libminzip LOCAL_CFLAGS += -Wall diff --git a/minzip/SysUtil.c b/minzip/SysUtil.c index ac6f5c33f..aac162d3a 100644 --- a/minzip/SysUtil.c +++ b/minzip/SysUtil.c @@ -116,7 +116,12 @@ static int sysMapBlockFile(FILE* mapf, MemMapping* pMap) // Reserve enough contiguous address space for the whole file. unsigned char* reserve; +#if (PLATFORM_SDK_VERSION >= 21) reserve = mmap64(NULL, blocks * blksize, PROT_NONE, MAP_PRIVATE | MAP_ANON, -1, 0); +#else + // Older versions of Android do not have mmap64 so we will just use mmap instead + reserve = mmap(NULL, blocks * blksize, PROT_NONE, MAP_PRIVATE | MAP_ANON, -1, 0); +#endif if (reserve == MAP_FAILED) { LOGW("failed to reserve address space: %s\n", strerror(errno)); return -1; @@ -138,8 +143,12 @@ static int sysMapBlockFile(FILE* mapf, MemMapping* pMap) LOGW("failed to parse range %d in block map\n", i); return -1; } - +#if (PLATFORM_SDK_VERSION >= 21) void* addr = mmap64(next, (end-start)*blksize, PROT_READ, MAP_PRIVATE | MAP_FIXED, fd, ((off64_t)start)*blksize); +#else + // Older versions of Android do not have mmap64 so we will just use mmap instead + void* addr = mmap(next, (end-start)*blksize, PROT_READ, MAP_PRIVATE | MAP_FIXED, fd, ((off64_t)start)*blksize); +#endif if (addr == MAP_FAILED) { LOGW("failed to map block %d: %s\n", i, strerror(errno)); return -1; |