|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2020, Andreas Kling <kling@serenityos.org> |
| 2 | + * Copyright (c) 2020-2021, Andreas Kling <kling@serenityos.org> |
3 | 3 | *
|
4 | 4 | * SPDX-License-Identifier: BSD-2-Clause
|
5 | 5 | */
|
6 | 6 |
|
7 | 7 | #include <LibCore/EventLoop.h>
|
8 | 8 | #include <LibCore/LocalServer.h>
|
9 | 9 | #include <LibIPC/ClientConnection.h>
|
| 10 | +#include <LibMain/Main.h> |
| 11 | +#include <LibSystem/Wrappers.h> |
10 | 12 | #include <WebContent/ClientConnection.h>
|
11 | 13 |
|
12 |
| -int main(int, char**) |
| 14 | +ErrorOr<int> serenity_main(Main::Arguments) |
13 | 15 | {
|
14 | 16 | Core::EventLoop event_loop;
|
15 |
| - if (pledge("stdio recvfd sendfd accept unix rpath", nullptr) < 0) { |
16 |
| - perror("pledge"); |
17 |
| - return 1; |
18 |
| - } |
19 |
| - if (unveil("/res", "r") < 0) { |
20 |
| - perror("unveil"); |
21 |
| - return 1; |
22 |
| - } |
23 |
| - if (unveil("/tmp/portal/request", "rw") < 0) { |
24 |
| - perror("unveil"); |
25 |
| - return 1; |
26 |
| - } |
27 |
| - if (unveil("/tmp/portal/image", "rw") < 0) { |
28 |
| - perror("unveil"); |
29 |
| - return 1; |
30 |
| - } |
31 |
| - if (unveil("/tmp/portal/websocket", "rw") < 0) { |
32 |
| - perror("unveil"); |
33 |
| - return 1; |
34 |
| - } |
35 |
| - if (unveil(nullptr, nullptr) < 0) { |
36 |
| - perror("unveil"); |
37 |
| - return 1; |
38 |
| - } |
| 17 | + TRY(System::pledge("stdio recvfd sendfd accept unix rpath", nullptr)); |
| 18 | + TRY(System::unveil("/res", "r")); |
| 19 | + TRY(System::unveil("/tmp/portal/request", "rw")); |
| 20 | + TRY(System::unveil("/tmp/portal/image", "rw")); |
| 21 | + TRY(System::unveil("/tmp/portal/websocket", "rw")); |
| 22 | + TRY(System::unveil(nullptr, nullptr)); |
39 | 23 |
|
40 | 24 | auto socket = Core::LocalSocket::take_over_accepted_socket_from_system_server();
|
41 | 25 | VERIFY(socket);
|
|
0 commit comments