From df7b81bdf5a501dcd049633bf3a38e84de549653 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 12 Jan 2020 12:29:40 +0100 Subject: [PATCH] Games: Use pledge() --- Games/Minesweeper/main.cpp | 12 ++++++++++++ Games/Snake/main.cpp | 11 +++++++++++ 2 files changed, 23 insertions(+) diff --git a/Games/Minesweeper/main.cpp b/Games/Minesweeper/main.cpp index c0bc6da998..40a00b7ecf 100644 --- a/Games/Minesweeper/main.cpp +++ b/Games/Minesweeper/main.cpp @@ -10,11 +10,23 @@ #include #include #include +#include int main(int argc, char** argv) { + if (pledge("stdio rpath wpath cpath shared_buffer unix fattr", nullptr) < 0) { + perror("pledge"); + return 1; + } + GApplication app(argc, argv); + if (pledge("stdio rpath wpath cpath shared_buffer", nullptr) < 0) { + perror("pledge"); + return 1; + } + + auto window = GWindow::construct(); window->set_resizable(false); window->set_title("Minesweeper"); diff --git a/Games/Snake/main.cpp b/Games/Snake/main.cpp index 70290b2dca..5b75d37867 100644 --- a/Games/Snake/main.cpp +++ b/Games/Snake/main.cpp @@ -8,11 +8,22 @@ #include #include #include +#include int main(int argc, char** argv) { + if (pledge("stdio rpath cpath shared_buffer unix fattr", nullptr) < 0) { + perror("pledge"); + return 1; + } + GApplication app(argc, argv); + if (pledge("stdio rpath shared_buffer", nullptr) < 0) { + perror("pledge"); + return 1; + } + auto window = GWindow::construct(); window->set_double_buffering_enabled(false);