summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGunnar Beutner <gbeutner@serenityos.org>2021-08-10 19:35:26 +0200
committerAndreas Kling <kling@serenityos.org>2021-08-10 20:17:34 +0200
commitf424485193854486c722d1a3b22a90c24ae4803b (patch)
tree2158abc02ac091c786eaa28c2c204a7e2f3017b9
parent02f9ffeb7f4332c8930b60ef4acf3d6f2cef4577 (diff)
downloadserenity-f424485193854486c722d1a3b22a90c24ae4803b.zip
LaunchServer: Make sure launching absolute symlinks works
This was broken by 31d659d.
-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 d2d0ccbd3e..56e2433a64 100644
--- a/Userland/Services/LaunchServer/Launcher.cpp
+++ b/Userland/Services/LaunchServer/Launcher.cpp
@@ -271,7 +271,9 @@ void Launcher::for_each_handler_for_path(const String& path, Function<bool(const
return;
if (S_ISLNK(st.st_mode)) {
- auto real_path = Core::File::real_path_for(String::formatted("{}/{}", LexicalPath::dirname(path), Core::File::read_link(path)));
+ auto link_target = LexicalPath { Core::File::read_link(path) };
+ LexicalPath absolute_link_target = link_target.is_absolute() ? link_target : LexicalPath::join(LexicalPath::dirname(path), link_target.string());
+ auto real_path = Core::File::real_path_for(absolute_link_target.string());
return for_each_handler_for_path(real_path, [&](const auto& handler) -> bool {
return f(handler);
});