From b4719eda048c4dc4a4b6e5280c7a2b8299051078 Mon Sep 17 00:00:00 2001 From: Raphael Moll Date: Wed, 16 Feb 2011 13:39:27 -0800 Subject: [PATCH] Open dexdump files in binary mode. Requires change Ia5c0a59e from system/core (which defines O_BINARY globally.) Change-Id: If814608ee9662190a7cf80aae2ad2451d88364ae --- libdex/CmdUtils.c | 2 +- libdex/ZipArchive.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libdex/CmdUtils.c b/libdex/CmdUtils.c index 35696f94f..8ce0d4b31 100644 --- a/libdex/CmdUtils.c +++ b/libdex/CmdUtils.c @@ -160,7 +160,7 @@ UnzipToFileResult dexOpenAndMap(const char* fileName, const char* tempFileName, /* * Pop open the (presumed) DEX file. */ - fd = open(fileName, O_RDONLY); + 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..efe9f79ac 100644 --- a/libdex/ZipArchive.c +++ b/libdex/ZipArchive.c @@ -341,7 +341,7 @@ int dexZipOpenArchive(const char* fileName, ZipArchive* pArchive) memset(pArchive, 0, sizeof(ZipArchive)); - fd = open(fileName, O_RDONLY, 0); + 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)); -- 2.11.0