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

rpcdump: Use pledge() and unveil()

This commit is contained in:
Brian Gianforcaro 2020-01-23 01:21:31 -08:00 committed by Andreas Kling
parent e3e22cd42e
commit cf151fa0e1

View file

@ -33,6 +33,18 @@
int main(int argc, char** argv)
{
if (pledge("stdio unix cpath fattr", nullptr) < 0) {
perror("pledge");
return 1;
}
if (unveil("/tmp", "rwc") < 0) {
perror("unveil");
return 1;
}
unveil(nullptr, nullptr);
if (argc != 2) {
printf("usage: %s <pid>\n", argv[0]);
return 0;
@ -44,6 +56,11 @@ int main(int argc, char** argv)
auto socket = CLocalSocket::construct();
if (pledge("stdio unix", nullptr) < 0) {
perror("pledge");
return 1;
}
socket->on_connected = [&] {
dbg() << "Connected to PID " << pid;