From d8c533f588f647ec36759e8630ca91e2e618ddc6 Mon Sep 17 00:00:00 2001 From: Brendan Coles Date: Tue, 15 Dec 2020 11:16:33 +0000 Subject: [PATCH] Breakout: use pledge and unveil --- Games/Breakout/main.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Games/Breakout/main.cpp b/Games/Breakout/main.cpp index 3bc25837aaa..6c3d003d38d 100644 --- a/Games/Breakout/main.cpp +++ b/Games/Breakout/main.cpp @@ -35,7 +35,28 @@ 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); + + if (pledge("stdio rpath shared_buffer", nullptr) < 0) { + perror("pledge"); + return 1; + } + + if (unveil("/res", "r") < 0) { + perror("unveil"); + return 1; + } + + if (unveil(nullptr, nullptr) < 0) { + perror("unveil"); + return 1; + } + auto window = GUI::Window::construct(); window->resize(Breakout::Game::game_width, Breakout::Game::game_height); auto app_icon = GUI::Icon::default_icon("app-breakout");