diff --git a/Userland/Services/WebContent/CMakeLists.txt b/Userland/Services/WebContent/CMakeLists.txt index 235829e0ca..b712d0487f 100644 --- a/Userland/Services/WebContent/CMakeLists.txt +++ b/Userland/Services/WebContent/CMakeLists.txt @@ -17,4 +17,4 @@ set(SOURCES ) serenity_bin(WebContent) -target_link_libraries(WebContent LibCore LibIPC LibGfx LibWeb) +target_link_libraries(WebContent LibCore LibIPC LibGfx LibWeb LibMain) diff --git a/Userland/Services/WebContent/main.cpp b/Userland/Services/WebContent/main.cpp index aa37ad0cf8..057c2de950 100644 --- a/Userland/Services/WebContent/main.cpp +++ b/Userland/Services/WebContent/main.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Andreas Kling + * Copyright (c) 2020-2021, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ @@ -7,35 +7,19 @@ #include #include #include +#include +#include #include -int main(int, char**) +ErrorOr serenity_main(Main::Arguments) { Core::EventLoop event_loop; - if (pledge("stdio recvfd sendfd accept unix rpath", nullptr) < 0) { - perror("pledge"); - return 1; - } - if (unveil("/res", "r") < 0) { - perror("unveil"); - return 1; - } - if (unveil("/tmp/portal/request", "rw") < 0) { - perror("unveil"); - return 1; - } - if (unveil("/tmp/portal/image", "rw") < 0) { - perror("unveil"); - return 1; - } - if (unveil("/tmp/portal/websocket", "rw") < 0) { - perror("unveil"); - return 1; - } - if (unveil(nullptr, nullptr) < 0) { - perror("unveil"); - return 1; - } + TRY(System::pledge("stdio recvfd sendfd accept unix rpath", nullptr)); + TRY(System::unveil("/res", "r")); + TRY(System::unveil("/tmp/portal/request", "rw")); + TRY(System::unveil("/tmp/portal/image", "rw")); + TRY(System::unveil("/tmp/portal/websocket", "rw")); + TRY(System::unveil(nullptr, nullptr)); auto socket = Core::LocalSocket::take_over_accepted_socket_from_system_server(); VERIFY(socket);