1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 19:14:58 +00:00
serenity/Userland/DevTools/HackStudio/LanguageServers/Shell/main.cpp
NonStdModel c93f73c617 HackStudio: Remove unnecessary unveil in ShellLanguageServer
Remove unveil on / with only browse permissions. Unveil will be sealed
later when the root path of project is known.
2021-06-12 22:49:20 +04:30

36 lines
911 B
C++

/*
* Copyright (c) 2020, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "ClientConnection.h"
#include <AK/LexicalPath.h>
#include <LibCore/EventLoop.h>
#include <LibCore/File.h>
#include <LibCore/LocalServer.h>
#include <LibIPC/ClientConnection.h>
#include <sys/stat.h>
#include <unistd.h>
int main(int, char**)
{
Core::EventLoop event_loop;
if (pledge("stdio unix rpath recvfd", nullptr) < 0) {
perror("pledge");
return 1;
}
auto socket = Core::LocalSocket::take_over_accepted_socket_from_system_server();
IPC::new_client_connection<LanguageServers::Shell::ClientConnection>(socket.release_nonnull(), 1);
if (pledge("stdio rpath recvfd", nullptr) < 0) {
perror("pledge");
return 1;
}
if (unveil("/etc/passwd", "r") < 0) {
perror("unveil");
return 1;
}
return event_loop.exec();
}