summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAart Bik <ajcbik@google.com>2016-04-29 13:12:10 -0700
committerAart Bik <ajcbik@google.com>2016-04-29 19:53:34 -0700
commitca223dc3a8ad00c417aa0a6d785503639ac19f25 (patch)
tree91db16bef8edae976bd9feedc1260e18d9cd65f5
parent5b9c1708bb861c8e8de47885769b633b2d86f0ac (diff)
downloaddalvik-ca223dc3a8ad00c417aa0a6d785503639ac19f25.tar.gz
Fix infamous 0d0a bug on Windows by not opening file binary.
Rationale: On Windows, writing out 0a really writes out 0d0a in text mode. Thus, the file should be opened in binary. On Linux, this is a nop (in fact O_BINARY does not exist). BUG=28385192 (cherry picked from commit 21a1b4488ba22eaabea941741c455cd6aa44b782) Change-Id: I906c610fdb2f43b1ef95eff2533a06af85de0850
-rw-r--r--libdex/CmdUtils.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libdex/CmdUtils.cpp b/libdex/CmdUtils.cpp
index cdb7bb982..8244a1189 100644
--- a/libdex/CmdUtils.cpp
+++ b/libdex/CmdUtils.cpp
@@ -54,7 +54,7 @@ UnzipToFileResult dexUnzipToFile(const char* zipFileName,
goto bail;
}
- fd = open(outFileName, O_RDWR | O_CREAT | O_EXCL, 0600);
+ fd = open(outFileName, O_RDWR | O_CREAT | O_EXCL | O_BINARY, 0600);
if (fd < 0) {
fprintf(stderr, "Unable to create output file '%s': %s\n",
outFileName, strerror(errno));