Skip to content

Commit 6b6594e

Browse files
bcolesawesomekling
authored andcommitted
MenuApplets: Username: init app early, pledge early, do not unveil /tmp
1 parent 738f5f4 commit 6b6594e

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

MenuApplets/UserName/main.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,14 @@ int main(int argc, char** argv)
6969
return 1;
7070
}
7171

72-
if (unveil("/res", "r") < 0) {
73-
perror("unveil");
72+
auto app = GUI::Application::construct(argc, argv);
73+
74+
if (pledge("stdio shared_buffer rpath", nullptr) < 0) {
75+
perror("pledge");
7476
return 1;
7577
}
7678

77-
if (unveil("/tmp", "rwc") < 0) {
79+
if (unveil("/res", "r") < 0) {
7880
perror("unveil");
7981
return 1;
8082
}
@@ -86,8 +88,6 @@ int main(int argc, char** argv)
8688

8789
unveil(nullptr, nullptr);
8890

89-
auto app = GUI::Application::construct(argc, argv);
90-
9191
auto window = GUI::Window::construct();
9292
window->set_title("UserName");
9393
window->set_window_type(GUI::WindowType::MenuApplet);
@@ -96,10 +96,5 @@ int main(int argc, char** argv)
9696
window->resize(widget.get_width(), 16);
9797
window->show();
9898

99-
if (pledge("stdio shared_buffer rpath", nullptr) < 0) {
100-
perror("pledge");
101-
return 1;
102-
}
103-
10499
return app->exec();
105100
}

0 commit comments

Comments
 (0)