libos/LocalServer: Clean up socket file on exit

This doesn't work if the process is killed by an unhandled signal.
This commit is contained in:
apio 2024-09-07 17:33:01 +02:00
parent 4cc8a44ec7
commit bb6759986e
Signed by: apio
GPG Key ID: B8A7D06E42258954
2 changed files with 3 additions and 0 deletions

View File

@ -136,6 +136,7 @@ namespace os
~LocalServer();
private:
StringView m_path;
int m_fd;
bool m_blocking;
};

View File

@ -43,6 +43,7 @@ namespace os
fcntl(sockfd, F_SETFD, FD_CLOEXEC);
server->m_fd = sockfd;
server->m_path = path;
return server;
}
@ -63,6 +64,7 @@ namespace os
LocalServer::~LocalServer()
{
close(m_fd);
os::FileSystem::remove(m_path);
}
LocalServer::Client::Client(Client&& other) : m_fd(other.m_fd)