From 6b6594e3d0bdf2407fce89e2c5315fa7a023d928 Mon Sep 17 00:00:00 2001 From: Brendan Coles Date: Sat, 26 Dec 2020 13:54:51 +0000 Subject: [PATCH] MenuApplets: Username: init app early, pledge early, do not unveil /tmp --- MenuApplets/UserName/main.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/MenuApplets/UserName/main.cpp b/MenuApplets/UserName/main.cpp index 79f3158ac3..666552a7d4 100644 --- a/MenuApplets/UserName/main.cpp +++ b/MenuApplets/UserName/main.cpp @@ -69,12 +69,14 @@ int main(int argc, char** argv) return 1; } - if (unveil("/res", "r") < 0) { - perror("unveil"); + auto app = GUI::Application::construct(argc, argv); + + if (pledge("stdio shared_buffer rpath", nullptr) < 0) { + perror("pledge"); return 1; } - if (unveil("/tmp", "rwc") < 0) { + if (unveil("/res", "r") < 0) { perror("unveil"); return 1; } @@ -86,8 +88,6 @@ int main(int argc, char** argv) unveil(nullptr, nullptr); - auto app = GUI::Application::construct(argc, argv); - auto window = GUI::Window::construct(); window->set_title("UserName"); window->set_window_type(GUI::WindowType::MenuApplet); @@ -96,10 +96,5 @@ int main(int argc, char** argv) window->resize(widget.get_width(), 16); window->show(); - if (pledge("stdio shared_buffer rpath", nullptr) < 0) { - perror("pledge"); - return 1; - } - return app->exec(); }