diff --git a/Userland/Services/LaunchServer/Launcher.cpp b/Userland/Services/LaunchServer/Launcher.cpp index dfb08bc457..d2d0ccbd3e 100644 --- a/Userland/Services/LaunchServer/Launcher.cpp +++ b/Userland/Services/LaunchServer/Launcher.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -252,8 +253,8 @@ void Launcher::for_each_handler(const String& key, HashMap& user void Launcher::for_each_handler_for_path(const String& path, Function f) { struct stat st; - if (stat(path.characters(), &st) < 0) { - perror("stat"); + if (lstat(path.characters(), &st) < 0) { + perror("lstat"); return; } @@ -269,6 +270,13 @@ void Launcher::for_each_handler_for_path(const String& path, Function bool { + return f(handler); + }); + } + if ((st.st_mode & S_IFMT) == S_IFREG && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) f(get_handler_for_executable(Handler::Type::Application, path));