mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:08:13 +00:00
LibCore: Don't try to unlink stale sockets in /tmp/rpc/
This was very obviously racy and would only succeed if we already own the socket anyway. (And if we do, we can bind to it without unlinking!) Work towards #4876.
This commit is contained in:
parent
d38b9916c9
commit
f152b6f7ed
1 changed files with 1 additions and 7 deletions
|
@ -314,18 +314,12 @@ EventLoop::~EventLoop()
|
|||
|
||||
bool EventLoop::start_rpc_server()
|
||||
{
|
||||
auto rpc_path = String::formatted("/tmp/rpc/{}", getpid());
|
||||
auto rc = unlink(rpc_path.characters());
|
||||
if (rc < 0 && errno != ENOENT) {
|
||||
perror("unlink");
|
||||
return false;
|
||||
}
|
||||
s_rpc_server = LocalServer::construct();
|
||||
s_rpc_server->set_name("Core::EventLoop_RPC_server");
|
||||
s_rpc_server->on_ready_to_accept = [&] {
|
||||
RPCClient::construct(s_rpc_server->accept());
|
||||
};
|
||||
return s_rpc_server->listen(rpc_path);
|
||||
return s_rpc_server->listen(String::formatted("/tmp/rpc/{}", getpid()));
|
||||
}
|
||||
|
||||
EventLoop& EventLoop::main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue