summaryrefslogtreecommitdiff
path: root/Userland/Services
diff options
context:
space:
mode:
authorMaciej <sppmacd@pm.me>2022-12-14 15:37:20 +0100
committerLinus Groh <mail@linusgroh.de>2022-12-14 15:48:25 +0000
commit569a0357863593813f5ad341261d3f52c3166b71 (patch)
tree0667cf8b7558309e46842bc8034fecadae57229b /Userland/Services
parent2bbea62176d05a7fa92e70f7de08306a9481e496 (diff)
downloadserenity-569a0357863593813f5ad341261d3f52c3166b71.zip
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).
Diffstat (limited to 'Userland/Services')
-rw-r--r--Userland/Services/LaunchServer/Launcher.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/Userland/Services/LaunchServer/Launcher.cpp b/Userland/Services/LaunchServer/Launcher.cpp
index b587532098..e59c271186 100644
--- a/Userland/Services/LaunchServer/Launcher.cpp
+++ b/Userland/Services/LaunchServer/Launcher.cpp
@@ -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());