From 2828d58a1025f80fc1c7af7c3433a8111412606e Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 23 Nov 2021 10:41:57 +0100 Subject: RequestServer: Port to LibMain :^) --- Userland/Services/RequestServer/main.cpp | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) (limited to 'Userland/Services/RequestServer/main.cpp') diff --git a/Userland/Services/RequestServer/main.cpp b/Userland/Services/RequestServer/main.cpp index 8062d2ea79..e8784ce371 100644 --- a/Userland/Services/RequestServer/main.cpp +++ b/Userland/Services/RequestServer/main.cpp @@ -4,11 +4,12 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include #include #include #include #include +#include +#include #include #include #include @@ -16,12 +17,9 @@ #include #include -int main(int, char**) +ErrorOr serenity_main(Main::Arguments) { - if (pledge("stdio inet accept unix rpath sendfd recvfd sigaction", nullptr) < 0) { - perror("pledge"); - return 1; - } + TRY(System::pledge("stdio inet accept unix rpath sendfd recvfd sigaction", nullptr)); signal(SIGINFO, [](int) { RequestServer::ConnectionCache::dump_jobs(); }); @@ -30,18 +28,9 @@ int main(int, char**) Core::EventLoop event_loop; // FIXME: Establish a connection to LookupServer and then drop "unix"? - if (pledge("stdio inet accept unix sendfd recvfd", nullptr) < 0) { - perror("pledge"); - return 1; - } - if (unveil("/tmp/portal/lookup", "rw") < 0) { - perror("unveil"); - return 1; - } - if (unveil(nullptr, nullptr) < 0) { - perror("unveil"); - return 1; - } + TRY(System::pledge("stdio inet accept unix sendfd recvfd", nullptr)); + TRY(System::unveil("/tmp/portal/lookup", "rw")); + TRY(System::unveil(nullptr, nullptr)); [[maybe_unused]] auto gemini = make(); [[maybe_unused]] auto http = make(); -- cgit v1.2.3