1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:07:44 +00:00

LookupServer: Port to LibMain :^)

This commit is contained in:
Andreas Kling 2021-11-23 15:30:59 +01:00
parent ddd99b4594
commit d8482134b6
2 changed files with 10 additions and 30 deletions

View file

@ -7,38 +7,18 @@
#include "LookupServer.h"
#include <LibCore/EventLoop.h>
#include <LibCore/LocalServer.h>
#include <stdio.h>
#include <unistd.h>
#include <LibCore/System.h>
#include <LibMain/Main.h>
int main([[maybe_unused]] int argc, [[maybe_unused]] char** argv)
ErrorOr<int> serenity_main(Main::Arguments)
{
if (pledge("stdio accept unix inet rpath", nullptr) < 0) {
perror("pledge");
return 1;
}
TRY(Core::System::pledge("stdio accept unix inet rpath", nullptr));
Core::EventLoop event_loop;
auto server = LookupServer::LookupServer::construct();
if (pledge("stdio accept inet rpath", nullptr) < 0) {
perror("pledge");
return 1;
}
if (unveil("/proc/net/adapters", "r") < 0) {
perror("unveil");
return 1;
}
if (unveil("/etc/hosts", "r") < 0) {
perror("unveil");
return 1;
}
if (unveil(nullptr, nullptr) < 0) {
perror("unveil");
return 1;
}
auto server = TRY(LookupServer::LookupServer::try_create());
TRY(Core::System::pledge("stdio accept inet rpath", nullptr));
TRY(Core::System::unveil("/proc/net/adapters", "r"));
TRY(Core::System::unveil("/etc/hosts", "r"));
TRY(Core::System::unveil(nullptr, nullptr));
return event_loop.exec();
}