mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
SystemMenu: chdir to home directory before launching apps
This commit is contained in:
parent
a4497ce375
commit
e2b7e7c390
Notes:
sideshowbarker
2024-07-19 08:15:58 +09:00
Author: https://github.com/itamar8910 Commit: https://github.com/SerenityOS/serenity/commit/e2b7e7c390d Pull-request: https://github.com/SerenityOS/serenity/pull/1477 Reviewed-by: https://github.com/bugaevc
1 changed files with 8 additions and 1 deletions
|
@ -28,6 +28,7 @@
|
|||
#include <AK/QuickSort.h>
|
||||
#include <LibCore/ConfigFile.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
#include <LibCore/UserInfo.h>
|
||||
#include <LibGUI/Action.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/Desktop.h>
|
||||
|
@ -80,6 +81,11 @@ int main(int argc, char** argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (chdir(get_current_user_home_path().characters()) < 0) {
|
||||
perror("chdir");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (unveil("/bin", "x")) {
|
||||
perror("unveil");
|
||||
return 1;
|
||||
|
@ -150,7 +156,8 @@ NonnullRefPtr<GUI::Menu> build_system_menu()
|
|||
dbg() << "Activated app with ID " << app_identifier;
|
||||
if (fork() == 0) {
|
||||
const auto& bin = g_apps[app_identifier].executable;
|
||||
execl(bin.characters(), bin.characters(), nullptr);
|
||||
if (execl(bin.characters(), bin.characters(), nullptr) < 0)
|
||||
perror("execl");
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
}));
|
||||
|
|
Loading…
Reference in a new issue