mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:07:45 +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:
parent
2bbea62176
commit
569a035786
1 changed files with 3 additions and 1 deletions
|
@ -309,8 +309,10 @@ void Launcher::for_each_handler_for_path(DeprecatedString const& path, Function<
|
||||||
|
|
||||||
if (S_ISLNK(st.st_mode)) {
|
if (S_ISLNK(st.st_mode)) {
|
||||||
auto link_target_or_error = Core::File::read_link(path);
|
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");
|
perror("read_link");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto link_target = LexicalPath { link_target_or_error.release_value() };
|
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());
|
LexicalPath absolute_link_target = link_target.is_absolute() ? link_target : LexicalPath::join(LexicalPath::dirname(path), link_target.string());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue