From 70b1312fd4056e6edc93187fe5e3e4dc6c5163a7 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 23 Nov 2021 15:25:17 +0100 Subject: [PATCH] ConfigServer: Port to LibMain :^) --- Userland/Services/ConfigServer/CMakeLists.txt | 2 +- Userland/Services/ConfigServer/main.cpp | 21 +++++++------------ 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/Userland/Services/ConfigServer/CMakeLists.txt b/Userland/Services/ConfigServer/CMakeLists.txt index febcc964ac..2cde832a98 100644 --- a/Userland/Services/ConfigServer/CMakeLists.txt +++ b/Userland/Services/ConfigServer/CMakeLists.txt @@ -15,4 +15,4 @@ set(SOURCES ) serenity_bin(ConfigServer) -target_link_libraries(ConfigServer LibIPC) +target_link_libraries(ConfigServer LibIPC LibMain) diff --git a/Userland/Services/ConfigServer/main.cpp b/Userland/Services/ConfigServer/main.cpp index 6bf07cd020..cde5a16075 100644 --- a/Userland/Services/ConfigServer/main.cpp +++ b/Userland/Services/ConfigServer/main.cpp @@ -7,24 +7,17 @@ #include "ClientConnection.h" #include #include -#include +#include +#include -int main(int, char**) +ErrorOr serenity_main(Main::Arguments) { - if (pledge("stdio accept rpath wpath cpath", nullptr) < 0) { - perror("pledge"); - return 1; - } - - if (unveil(Core::StandardPaths::config_directory().characters(), "rwc") < 0) { - perror("unveil"); - return 1; - } - - unveil(nullptr, nullptr); + TRY(Core::System::pledge("stdio accept rpath wpath cpath", nullptr)); + TRY(Core::System::unveil(Core::StandardPaths::config_directory(), "rwc")); + TRY(Core::System::unveil(nullptr, nullptr)); Core::EventLoop event_loop; - auto server = Core::LocalServer::construct(); + auto server = TRY(Core::LocalServer::try_create()); bool ok = server->take_over_from_system_server(); VERIFY(ok);