1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:37:35 +00:00

Browser: Use pledge()

This is the first complex app to use pledge(), and it was extremely
easy to get it working.

The main trickiness comes from the RPC sockets that get set up inside
the GApplication constructor. Since it wants to unlink any old RPC
socket with the same filename and change the file mode of the new
socket, it needs both "cpath" and "fattr".

Once the GApplication has been constructed, it seems we can safely
drop those promises. Pretty cool!
This commit is contained in:
Andreas Kling 2020-01-11 20:50:27 +01:00
parent e131a401e8
commit 2f880a047f

View file

@ -30,8 +30,18 @@ static const char* home_url = "file:///home/anon/www/welcome.html";
int main(int argc, char** argv)
{
if (pledge("stdio dns unix shared_buffer cpath rpath fattr", nullptr) < 0) {
perror("pledge");
return 1;
}
GApplication app(argc, argv);
if (pledge("stdio dns unix shared_buffer rpath", nullptr) < 0) {
perror("pledge");
return 1;
}
auto window = GWindow::construct();
window->set_rect(100, 100, 640, 480);