2021-06-28 22:15:17 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <LibCore/EventLoop.h>
|
2021-12-06 12:01:23 -03:00
|
|
|
#include <LibCore/System.h>
|
2021-12-06 13:54:11 -03:00
|
|
|
#include <LibIPC/MultiServer.h>
|
2021-12-06 12:01:23 -03:00
|
|
|
#include <LibMain/Main.h>
|
2022-02-25 07:18:30 -03:00
|
|
|
#include <SQLServer/ConnectionFromClient.h>
|
2021-06-28 22:15:17 -03:00
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
|
2021-12-06 12:01:23 -03:00
|
|
|
ErrorOr<int> serenity_main(Main::Arguments)
|
2021-06-28 22:15:17 -03:00
|
|
|
{
|
2021-12-06 12:01:23 -03:00
|
|
|
TRY(Core::System::pledge("stdio accept unix rpath wpath cpath"));
|
2021-06-28 22:15:17 -03:00
|
|
|
|
2021-08-30 12:06:29 -03:00
|
|
|
if (mkdir("/home/anon/sql", 0700) < 0 && errno != EEXIST) {
|
|
|
|
|
perror("mkdir");
|
|
|
|
|
return 1;
|
2021-06-28 22:15:17 -03:00
|
|
|
}
|
|
|
|
|
|
2021-12-06 12:01:23 -03:00
|
|
|
TRY(Core::System::unveil("/home/anon/sql", "rwc"));
|
|
|
|
|
TRY(Core::System::unveil(nullptr, nullptr));
|
2021-06-28 22:15:17 -03:00
|
|
|
|
|
|
|
|
Core::EventLoop event_loop;
|
|
|
|
|
|
2022-02-25 07:18:30 -03:00
|
|
|
auto server = TRY(IPC::MultiServer<SQLServer::ConnectionFromClient>::try_create());
|
2021-06-28 22:15:17 -03:00
|
|
|
return event_loop.exec();
|
|
|
|
|
}
|