summaryrefslogtreecommitdiffstats
path: root/libdex
diff options
context:
space:
mode:
Diffstat (limited to 'libdex')
-rw-r--r--libdex/CmdUtils.c5
-rw-r--r--libdex/ZipArchive.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/libdex/CmdUtils.c b/libdex/CmdUtils.c
index 35696f94f..e8fc635f9 100644
--- a/libdex/CmdUtils.c
+++ b/libdex/CmdUtils.c
@@ -160,7 +160,10 @@ UnzipToFileResult dexOpenAndMap(const char* fileName, const char* tempFileName,
/*
* Pop open the (presumed) DEX file.
*/
- fd = open(fileName, O_RDONLY);
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+ fd = open(fileName, O_RDONLY | O_BINARY);
if (fd < 0) {
if (!quiet) {
fprintf(stderr, "ERROR: unable to open '%s': %s\n",
diff --git a/libdex/ZipArchive.c b/libdex/ZipArchive.c
index 756f4883d..7feb417b8 100644
--- a/libdex/ZipArchive.c
+++ b/libdex/ZipArchive.c
@@ -341,7 +341,10 @@ int dexZipOpenArchive(const char* fileName, ZipArchive* pArchive)
memset(pArchive, 0, sizeof(ZipArchive));
- fd = open(fileName, O_RDONLY, 0);
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+ fd = open(fileName, O_RDONLY | O_BINARY, 0);
if (fd < 0) {
err = errno ? errno : -1;
LOGV("Unable to open '%s': %s\n", fileName, strerror(err));