FEXServerClient: Ensure server socket is created with SOCK_CLOEXEC

To make sure we don't have dangling FDs when an application calls
execve, enable this flag.
This commit is contained in:
Ryan Houdek 2023-06-28 09:17:20 -07:00
parent 7ee6fc0d7f
commit 3372e9bdbb

View File

@ -153,7 +153,7 @@ namespace FEXServerClient {
auto ServerSocketName = GetServerSocketName();
// Create the initial unix socket
int SocketFD = socket(AF_UNIX, SOCK_STREAM, 0);
int SocketFD = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
if (SocketFD == -1) {
LogMan::Msg::EFmt("Couldn't open AF_UNIX socket {} {}", errno, strerror(errno));
return -1;