mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +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
Notes:
sideshowbarker
2024-07-18 23:58:06 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/f152b6f7ed6
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…
Reference in a new issue