pledge: Prefer FileSystem over DeprecatedFile

This commit is contained in:
Ben Wiederhake 2023-05-13 00:10:52 +02:00 committed by Andreas Kling
parent 8c2cdb7bc7
commit 77f021f5f1
Notes: sideshowbarker 2024-07-17 06:29:49 +09:00
2 changed files with 4 additions and 7 deletions

View File

@ -119,6 +119,7 @@ target_link_libraries(notify PRIVATE LibGfx LibGUI)
target_link_libraries(open PRIVATE LibDesktop) target_link_libraries(open PRIVATE LibDesktop)
target_link_libraries(passwd PRIVATE LibCrypt) target_link_libraries(passwd PRIVATE LibCrypt)
target_link_libraries(paste PRIVATE LibGUI) target_link_libraries(paste PRIVATE LibGUI)
target_link_libraries(pledge PRIVATE LibFileSystem)
target_link_libraries(pgrep PRIVATE LibRegex) target_link_libraries(pgrep PRIVATE LibRegex)
target_link_libraries(pkill PRIVATE LibRegex) target_link_libraries(pkill PRIVATE LibRegex)
target_link_libraries(pls PRIVATE LibCrypt) target_link_libraries(pls PRIVATE LibCrypt)

View File

@ -5,20 +5,16 @@
*/ */
#include <LibCore/ArgsParser.h> #include <LibCore/ArgsParser.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/MappedFile.h> #include <LibCore/MappedFile.h>
#include <LibCore/System.h> #include <LibCore/System.h>
#include <LibELF/Image.h> #include <LibELF/Image.h>
#include <LibFileSystem/FileSystem.h>
#include <LibMain/Main.h> #include <LibMain/Main.h>
static ErrorOr<bool> is_dynamically_linked_executable(StringView filename) static ErrorOr<bool> is_dynamically_linked_executable(StringView filename)
{ {
auto maybe_executable = Core::DeprecatedFile::resolve_executable_from_environment(filename); auto executable = TRY(FileSystem::resolve_executable_from_environment(filename));
auto file = TRY(Core::MappedFile::map(executable));
if (!maybe_executable.has_value())
return ENOENT;
auto file = TRY(Core::MappedFile::map(maybe_executable.release_value()));
ELF::Image elf_image(file->bytes()); ELF::Image elf_image(file->bytes());
return elf_image.is_dynamic(); return elf_image.is_dynamic();
} }