diff options
author | Andrew Kaster <akaster@serenityos.org> | 2022-04-30 23:43:20 -0600 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-05-02 01:45:49 +0200 |
commit | 9b041786ac76e925a664a44b1e0a0f8947643d5f (patch) | |
tree | 454704fdbf553bde38c73e18f6e909cf0fb15c5f /Userland/Utilities | |
parent | 4b0b22d8970ed426e21f35665ff3008f9f7b7a7a (diff) | |
download | serenity-9b041786ac76e925a664a44b1e0a0f8947643d5f.zip |
readelf: Don't error out on invalid interpreter path
This lets us inspect ELF binaries with un-loadable program interpreters,
same as binutils and llvm-readelf.
Diffstat (limited to 'Userland/Utilities')
-rw-r--r-- | Userland/Utilities/readelf.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/Userland/Utilities/readelf.cpp b/Userland/Utilities/readelf.cpp index 2d811c4b8d..8403213c75 100644 --- a/Userland/Utilities/readelf.cpp +++ b/Userland/Utilities/readelf.cpp @@ -325,16 +325,14 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) if (interpreter_file_or_error.is_error()) { warnln("Unable to map interpreter file {}: {}", interpreter_path, interpreter_file_or_error.error()); - return -1; - } - - auto interpreter_image_data = interpreter_file_or_error.value()->bytes(); + } else { + auto interpreter_image_data = interpreter_file_or_error.value()->bytes(); - ELF::Image interpreter_image(interpreter_image_data); + ELF::Image interpreter_image(interpreter_image_data); - if (!interpreter_image.is_valid()) { - warnln("ELF interpreter image is invalid"); - return -1; + if (!interpreter_image.is_valid()) { + warnln("ELF interpreter image is invalid"); + } } int fd = TRY(Core::System::open(path, O_RDONLY)); |