diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-01-08 13:16:00 (GMT) |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-01-08 13:16:00 (GMT) |
commit | c361e32940ecb9803ce2a8078e60949fa10525ad (patch) | |
tree | 0a2f57a4e1b233c4303afe208c1c082faf0024c5 | |
parent | a5a9a9ab9617125c4d1458a98deb7ca9fc0f2fb7 (diff) | |
parent | 991168c1ff0df19f00b9afcbee1552b834c2dd15 (diff) | |
download | patchelf-c361e32940ecb9803ce2a8078e60949fa10525ad.zip patchelf-c361e32940ecb9803ce2a8078e60949fa10525ad.tar.gz patchelf-c361e32940ecb9803ce2a8078e60949fa10525ad.tar.bz2 |
Merge branch 'patch-3' of https://github.com/darealshinji/patchelf
-rw-r--r-- | src/patchelf.cc | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/patchelf.cc b/src/patchelf.cc index 1751af3..5b2f333 100644 --- a/src/patchelf.cc +++ b/src/patchelf.cc @@ -236,12 +236,11 @@ static void growFile(off_t newSize) } -static void readFile(string fileName, mode_t * fileMode) +static void readFile(string fileName) { struct stat st; if (stat(fileName.c_str(), &st) != 0) error("stat"); fileSize = st.st_size; - *fileMode = st.st_mode; maxSize = fileSize + 32 * 1024 * 1024; contents = (unsigned char *) malloc(fileSize + maxSize); @@ -1379,7 +1378,7 @@ static set<string> neededLibsToAdd; static bool noDefaultLib = false; template<class ElfFile> -static void patchElf2(ElfFile & elfFile, mode_t fileMode) +static void patchElf2(ElfFile & elfFile) { elfFile.parse(); @@ -1426,9 +1425,7 @@ static void patchElf() debug("Kernel page size is %u bytes\n", getPageSize()); - mode_t fileMode; - - readFile(fileName, &fileMode); + readFile(fileName); /* Check the ELF header for basic validity. */ @@ -1441,13 +1438,13 @@ static void patchElf() contents[EI_VERSION] == EV_CURRENT) { ElfFile<Elf32_Ehdr, Elf32_Phdr, Elf32_Shdr, Elf32_Addr, Elf32_Off, Elf32_Dyn, Elf32_Sym> elfFile; - patchElf2(elfFile, fileMode); + patchElf2(elfFile); } else if (contents[EI_CLASS] == ELFCLASS64 && contents[EI_VERSION] == EV_CURRENT) { ElfFile<Elf64_Ehdr, Elf64_Phdr, Elf64_Shdr, Elf64_Addr, Elf64_Off, Elf64_Dyn, Elf64_Sym> elfFile; - patchElf2(elfFile, fileMode); + patchElf2(elfFile); } else { error("ELF executable is not 32/64-bit, little/big-endian, version 1"); |