1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 04:58:13 +00:00

ImageDecoder: Port to LibMain :^)

This commit is contained in:
Andreas Kling 2021-11-23 10:39:52 +01:00
parent c6a581f267
commit 5e93db93fc
2 changed files with 8 additions and 15 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2020-2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -8,24 +8,17 @@
#include <LibCore/EventLoop.h>
#include <LibCore/LocalServer.h>
#include <LibIPC/ClientConnection.h>
#include <LibMain/Main.h>
#include <LibSystem/Wrappers.h>
int main(int, char**)
ErrorOr<int> serenity_main(Main::Arguments)
{
Core::EventLoop event_loop;
if (pledge("stdio recvfd sendfd unix", nullptr) < 0) {
perror("pledge");
return 1;
}
if (unveil(nullptr, nullptr) < 0) {
perror("unveil");
return 1;
}
TRY(System::pledge("stdio recvfd sendfd unix", nullptr));
TRY(System::unveil(nullptr, nullptr));
auto socket = Core::LocalSocket::take_over_accepted_socket_from_system_server();
IPC::new_client_connection<ImageDecoder::ClientConnection>(socket.release_nonnull(), 1);
if (pledge("stdio recvfd sendfd", nullptr) < 0) {
perror("pledge");
return 1;
}
TRY(System::pledge("stdio recvfd sendfd", nullptr));
return event_loop.exec();
}