1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:17:35 +00:00

Applications: Use pledge and unveil

This commit is contained in:
Brendan Coles 2020-11-02 21:34:29 +00:00 committed by Andreas Kling
parent 9efcb5d290
commit ed5469c1c2
5 changed files with 84 additions and 7 deletions

View file

@ -26,6 +26,7 @@
#include "IRCAppWindow.h"
#include "IRCClient.h"
#include <LibCore/StandardPaths.h>
#include <LibGUI/Application.h>
#include <LibGUI/MessageBox.h>
#include <stdio.h>
@ -49,6 +50,36 @@ int main(int argc, char** argv)
return 1;
}
if (unveil("/tmp/portal/lookup", "rw") < 0) {
perror("unveil");
return 1;
}
if (unveil("/tmp/portal/notify", "rw") < 0) {
perror("unveil");
return 1;
}
if (unveil("/etc/passwd", "r") < 0) {
perror("unveil");
return 1;
}
if (unveil(Core::StandardPaths::home_directory().characters(), "rwc") < 0) {
perror("unveil");
return 1;
}
if (unveil("/res", "r") < 0) {
perror("unveil");
return 1;
}
if (unveil(nullptr, nullptr) < 0) {
perror("unveil");
return 1;
}
URL url = "";
if (app->args().size() >= 1) {
url = URL::create_with_url_or_path(app->args()[0]);