1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:18:13 +00:00

IRCClient: Refuse to run as root

There's no good reason to allow this, and some pretty great reasons
to disallow it. :^)
This commit is contained in:
Andreas Kling 2020-03-31 12:59:34 +02:00
parent e8b17c42bb
commit b2b5da8a17

View file

@ -27,6 +27,7 @@
#include "IRCAppWindow.h"
#include "IRCClient.h"
#include <LibGUI/Application.h>
#include <LibGUI/MessageBox.h>
#include <stdio.h>
int main(int argc, char** argv)
@ -36,6 +37,11 @@ int main(int argc, char** argv)
return 1;
}
if (getuid() == 0) {
fprintf(stderr, "Refusing to run as root\n");
return 1;
}
GUI::Application app(argc, argv);
if (pledge("stdio inet dns unix shared_buffer rpath", nullptr) < 0) {