summaryrefslogtreecommitdiff
path: root/tests/elfshphehdr.c
Commit message (Collapse)AuthorAgeFilesLines
* Write to /dev/null rather than /dev/zeroUlf Hermann2017-07-241-1/+1
| | | | | | | /dev/zero is meant for reading zeroes. /dev/null is for writing into nirvana. Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
* libelf: Allow updating phdrs for any e_type.Mark Wielaard2016-07-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | elf[32|64]_updatenull would sanity check the e_type before allowing to update the phdrs. This prevents creating an ET_REL file with phdrs. It also prevents creating any vendor specific ELF file having phdrs. We only check this when updating/writing out the file. But we would just read such files. Don't prevent people from creating unexpected ELF files. elflint will warn for such files. While writing a new testcase for this another bug was found that prevented updating a just created phdr because elf_getphdrnum would sanity check the phdr offset in the file (which doesn't exist yet). Fix that by only doing such a sanity check if the phdrs haven't been read in or created yet. This second bug should have been found by the existing elfshphehdr test, but that test contained a typo checking elf_getphdrnum. It tested that the called failed when there were no phdrs, but then elf_getphdrnum should simply succeed and return zero. https://bugzilla.redhat.com/show_bug.cgi?id=1352232 Signed-off-by: Mark Wielaard <mjw@redhat.com>
* tests: Rename argument from check to statement in elfshphehdr.c.Mark Wielaard2015-10-091-4/+4
| | | | | | Some older compilers warn about a function and argument name being equal. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* libelf: Always update e_version and e_shentsize in elf_update.Mark Wielaard2015-10-051-0/+182
When e_version is EV_NONE we should set it to EV_CURRENT like we do for the EI_VERSION and like we set EI_DATA to the correct byte order when set to ELFDATANONE. Likewise we should always set e_shentsize like we do for e_phentsize, not just when ELF_F_LAYOUT isn't set. Add a new elfshphehdr testcase to check the above. Signed-off-by: Mark Wielaard <mjw@redhat.com>