summaryrefslogtreecommitdiffstats
path: root/libdex/CmdUtils.cpp
diff options
context:
space:
mode:
authorNarayan Kamath <narayan@google.com>2013-12-17 10:48:53 +0000
committerNarayan Kamath <narayan@google.com>2013-12-18 11:59:26 +0000
commit1506726d9ccd8404b3af6c51173f637cc88aaffe (patch)
tree1bb3e7a1f0571248b053ef075283f7de839b07d1 /libdex/CmdUtils.cpp
parent254d5a292272ef9352505eca98e08200c75bb042 (diff)
downloadandroid_dalvik-1506726d9ccd8404b3af6c51173f637cc88aaffe.tar.gz
android_dalvik-1506726d9ccd8404b3af6c51173f637cc88aaffe.tar.bz2
android_dalvik-1506726d9ccd8404b3af6c51173f637cc88aaffe.zip
Fix a few bugs introduced by the move to zip_archive.
- mmap failures because the output file was opened with O_WRONLY instead of O_RDWR - In two instances, we were passing the wrong handle to CloseArchive(ZipArchiveHandle). The issue is code like this: ZipArchiveHandle h; OpenArchive(&h); CloseArchive(&h); This compiles, but isn't correct. ZipArchiveHandle is a typedef for (void *) and the compiler won't complain because void** is also void*. Some of this code was written before the API was changed from CloseArchive(ZipArchiveHandle&) to CloseArchie(ZipArchiveHandle) but continued to compile even after the API change. I'll change the API in the follow up to catch errors like this at compile time. bug: 12173498 bug: 12176258 bug: 12178641 Change-Id: I71ac36654311f582b5ab633e1ed0d13e00053c84
Diffstat (limited to 'libdex/CmdUtils.cpp')
-rw-r--r--libdex/CmdUtils.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/libdex/CmdUtils.cpp b/libdex/CmdUtils.cpp
index bf89444cc..cdb7bb982 100644
--- a/libdex/CmdUtils.cpp
+++ b/libdex/CmdUtils.cpp
@@ -54,7 +54,7 @@ UnzipToFileResult dexUnzipToFile(const char* zipFileName,
goto bail;
}
- fd = open(outFileName, O_WRONLY | O_CREAT | O_EXCL, 0600);
+ fd = open(outFileName, O_RDWR | O_CREAT | O_EXCL, 0600);
if (fd < 0) {
fprintf(stderr, "Unable to create output file '%s': %s\n",
outFileName, strerror(errno));
@@ -85,7 +85,7 @@ bail:
close(fd);
if (unlinkOnFailure && result != kUTFRSuccess)
unlink(outFileName);
- dexZipCloseArchive(&archive);
+ dexZipCloseArchive(archive);
return result;
}