open the odex file as read-only

git-svn-id: https://smali.googlecode.com/svn/trunk@482 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
JesusFreke@JesusFreke.com 2009-11-08 05:00:55 +00:00
parent 090e553f34
commit 6ff845a9c1

View File

@ -417,7 +417,7 @@ int main(int argc, char* const argv[])
return 1; return 1;
} }
int odexFd = open(inputFileName, O_RDWR, 0644); int odexFd = open(inputFileName, O_RDONLY);
if (odexFd < 0) { if (odexFd < 0) {
fprintf(stderr, "Unable to open '%s': %s\n", inputFileName, strerror(errno)); fprintf(stderr, "Unable to open '%s': %s\n", inputFileName, strerror(errno));
return 1; return 1;
@ -466,8 +466,8 @@ int main(int argc, char* const argv[])
*/ */
bool success; bool success;
void* mapAddr; void* mapAddr;
mapAddr = mmap(NULL, inputInfo.st_size, PROT_READ|PROT_WRITE, mapAddr = mmap(NULL, inputInfo.st_size, PROT_READ,
MAP_SHARED, odexFd, 0); MAP_PRIVATE, odexFd, 0);
if (mapAddr == MAP_FAILED) { if (mapAddr == MAP_FAILED) {
fprintf(stderr, "unable to mmap DEX cache: %s\n", strerror(errno)); fprintf(stderr, "unable to mmap DEX cache: %s\n", strerror(errno));
return 1; return 1;