diff options
author | Mike Frysinger <vapier@gentoo.org> | 2017-03-04 13:36:29 -0800 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2018-06-07 10:05:50 -0400 |
commit | 7853dba4ac9405793cc5275fd38c722b1cba2978 (patch) | |
tree | f6ee148489e76bc3ceee3f525cf4767055b3cd14 /paxelf.c | |
parent | scanelf: add general const markings to Elf pointers (diff) | |
download | pax-utils-7853dba4ac9405793cc5275fd38c722b1cba2978.tar.gz pax-utils-7853dba4ac9405793cc5275fd38c722b1cba2978.tar.bz2 pax-utils-7853dba4ac9405793cc5275fd38c722b1cba2978.zip |
paxelf: constify elfobj pointers
We rarely need to modify the memory from our input ELFs, so constify all
the buffers. We end up having to cast away the const in the "fix" paths
in scanelf (which is a bit ugly), but otherwise everything else works.
Diffstat (limited to 'paxelf.c')
-rw-r--r-- | paxelf.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -558,7 +558,7 @@ const char *get_elfnttype(uint16_t e_type, const char *name, int type) ((buff[EI_CLASS] == ELFCLASS32 || buff[EI_CLASS] == ELFCLASS64) && \ (buff[EI_DATA] == ELFDATA2LSB || buff[EI_DATA] == ELFDATA2MSB) && \ (buff[EI_VERSION] == EV_CURRENT)) -elfobj *readelf_buffer(const char *filename, void *buffer, size_t buffer_len) +elfobj *readelf_buffer(const char *filename, const void *buffer, size_t buffer_len) { elfobj *elf; @@ -720,7 +720,7 @@ elfobj *_readelf(const char *filename, int read_only) /* undo the readelf() stuff */ void unreadelf(elfobj *elf) { - if (elf->is_mmap) munmap(elf->vdata, elf->len); + if (elf->is_mmap) munmap((void *)elf->vdata, elf->len); if (elf->fd != -1) close(elf->fd); if (!__PAX_UNALIGNED_OK) free(elf->_data); free(elf); |