summaryrefslogtreecommitdiff
path: root/Userland/Services/RequestServer/main.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-11-23 10:41:57 +0100
committerAndreas Kling <kling@serenityos.org>2021-11-23 11:33:36 +0100
commit2828d58a1025f80fc1c7af7c3433a8111412606e (patch)
tree16ecc0b77ea108cdc753846c98830e3cb639064a /Userland/Services/RequestServer/main.cpp
parent5e93db93fc24bf78f2d1e6858fa02eaadde326a1 (diff)
downloadserenity-2828d58a1025f80fc1c7af7c3433a8111412606e.zip
RequestServer: Port to LibMain :^)
Diffstat (limited to 'Userland/Services/RequestServer/main.cpp')
-rw-r--r--Userland/Services/RequestServer/main.cpp25
1 files changed, 7 insertions, 18 deletions
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 <AK/Debug.h>
#include <AK/OwnPtr.h>
#include <LibCore/EventLoop.h>
#include <LibCore/LocalServer.h>
#include <LibIPC/ClientConnection.h>
+#include <LibMain/Main.h>
+#include <LibSystem/Wrappers.h>
#include <LibTLS/Certificate.h>
#include <RequestServer/ClientConnection.h>
#include <RequestServer/GeminiProtocol.h>
@@ -16,12 +17,9 @@
#include <RequestServer/HttpsProtocol.h>
#include <signal.h>
-int main(int, char**)
+ErrorOr<int> 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<RequestServer::GeminiProtocol>();
[[maybe_unused]] auto http = make<RequestServer::HttpProtocol>();