1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 10:47:35 +00:00

LaunchServer: Return if read_link fails in for_each_handler_for_path

Previously we were just printing error and then doing release_value(),
causing crash when opening links that cannot be read (e.g in /proc).
This commit is contained in:
Maciej 2022-12-14 15:37:20 +01:00 committed by Linus Groh
parent 2bbea62176
commit 569a035786

View file

@ -309,8 +309,10 @@ void Launcher::for_each_handler_for_path(DeprecatedString const& path, Function<
if (S_ISLNK(st.st_mode)) {
auto link_target_or_error = Core::File::read_link(path);
if (link_target_or_error.is_error())
if (link_target_or_error.is_error()) {
perror("read_link");
return;
}
auto link_target = LexicalPath { link_target_or_error.release_value() };
LexicalPath absolute_link_target = link_target.is_absolute() ? link_target : LexicalPath::join(LexicalPath::dirname(path), link_target.string());