diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2005-09-30 09:50:51 (GMT) |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2005-09-30 09:50:51 (GMT) |
commit | 955d3334eda909b1dba213638e0d44ea3ea00420 (patch) | |
tree | 0b6e662aa3c5fe18bd9c9dc1c568046ca3dd7d89 /src | |
parent | 3dd9c1ffcaa052642a2ed5037eb838c3df43e6ba (diff) | |
download | patchelf-955d3334eda909b1dba213638e0d44ea3ea00420.zip patchelf-955d3334eda909b1dba213638e0d44ea3ea00420.tar.gz patchelf-955d3334eda909b1dba213638e0d44ea3ea00420.tar.bz2 |
* Use a real programming language.
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/patchelf.cc (renamed from src/patchelf.c) | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index d61eee2..0bf1f83 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,3 +1,3 @@ bin_PROGRAMS = patchelf -patchelf_SOURCES = patchelf.c +patchelf_SOURCES = patchelf.cc diff --git a/src/patchelf.c b/src/patchelf.cc index a957aa1..d0a5a2c 100644 --- a/src/patchelf.c +++ b/src/patchelf.cc @@ -65,7 +65,7 @@ static void readFile(char * fileName, mode_t * fileMode) *fileMode = st.st_mode; maxSize = fileSize + 128 * 1024; - contents = malloc(fileSize + maxSize); + contents = (unsigned char *) malloc(fileSize + maxSize); if (!contents) abort(); int fd = open(fileName, O_RDONLY); @@ -169,7 +169,7 @@ static void setInterpreter(void) growFile(phdr->p_offset + interpSize); phdr->p_vaddr = phdr->p_paddr = firstPage + interpOffset % 4096; phdr->p_filesz = phdr->p_memsz = interpSize; - strncpy(contents + interpOffset, + strncpy((char *) contents + interpOffset, newInterpreter, interpSize); changed = 1; break; @@ -219,7 +219,7 @@ static void shrinkRPath(void) if (phdrs[i].p_vaddr <= strTabAddr && strTabAddr < phdrs[i].p_vaddr + phdrs[i].p_filesz) { - strTab = contents + + strTab = (char *) contents + strTabAddr - phdrs[i].p_vaddr + phdrs[i].p_offset; } @@ -257,7 +257,7 @@ static void shrinkRPath(void) for (i = 0; i < nrNeededLibs; ++i) neededLibFound[i] = 0; - char * newRPath = malloc(strlen(rpath) + 1); + char * newRPath = (char *) malloc(strlen(rpath) + 1); *newRPath = 0; char * pos = rpath; |