CatDog: Add pledge() and lock unveil state

This commit is contained in:
Brendan Coles 2021-01-12 06:41:08 +00:00 committed by Andreas Kling
parent 959970e060
commit 24d6814ee5
Notes: sideshowbarker 2024-07-18 23:54:38 +09:00

View file

@ -194,6 +194,11 @@ private:
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
if (pledge("stdio rpath wpath cpath shared_buffer accept unix fattr", nullptr) < 0) {
perror("pledge");
return 1;
}
auto app = GUI::Application::construct(argc, argv); auto app = GUI::Application::construct(argc, argv);
auto app_icon = GUI::Icon::default_icon("app-catdog"); auto app_icon = GUI::Icon::default_icon("app-catdog");
@ -207,6 +212,11 @@ int main(int argc, char** argv)
return 1; return 1;
} }
if (unveil(nullptr, nullptr) < 0) {
perror("unveil");
return 1;
}
auto window = GUI::Window::construct(); auto window = GUI::Window::construct();
window->set_title("CatDog Demo"); window->set_title("CatDog Demo");
window->resize(32, 32); window->resize(32, 32);