1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:37:34 +00:00

SQLServer: Port to LibMain :^)

This commit is contained in:
Andreas Kling 2021-12-06 16:01:23 +01:00
parent 69ea1ff743
commit 229a45ab14
2 changed files with 8 additions and 16 deletions

View file

@ -6,34 +6,26 @@
#include <LibCore/EventLoop.h>
#include <LibCore/LocalServer.h>
#include <LibCore/System.h>
#include <LibMain/Main.h>
#include <SQLServer/ClientConnection.h>
#include <stdio.h>
#include <sys/stat.h>
#include <unistd.h>
int main([[maybe_unused]] int argc, [[maybe_unused]] char** argv)
ErrorOr<int> serenity_main(Main::Arguments)
{
if (pledge("stdio accept unix rpath wpath cpath", nullptr) < 0) {
perror("pledge");
return 1;
}
TRY(Core::System::pledge("stdio accept unix rpath wpath cpath"));
if (mkdir("/home/anon/sql", 0700) < 0 && errno != EEXIST) {
perror("mkdir");
return 1;
}
if (unveil("/home/anon/sql", "rwc") < 0) {
perror("unveil");
return 1;
}
if (unveil(nullptr, nullptr) < 0) {
perror("unveil");
return 1;
}
TRY(Core::System::unveil("/home/anon/sql", "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);