RemoteStore::connectToDaemon(): Set close-on-exec flag

This ensures that "nix-build --run-env" doesn't keep a connection to
the worker open, preventing it from exiting.
This commit is contained in:
Eelco Dolstra 2012-09-13 14:46:37 -04:00
parent e6e495649c
commit 8fbe96cb31

View file

@ -141,6 +141,7 @@ void RemoteStore::connectToDaemon()
fdSocket = socket(PF_UNIX, SOCK_STREAM, 0); fdSocket = socket(PF_UNIX, SOCK_STREAM, 0);
if (fdSocket == -1) if (fdSocket == -1)
throw SysError("cannot create Unix domain socket"); throw SysError("cannot create Unix domain socket");
closeOnExec(fdSocket);
string socketPath = settings.nixStateDir + DEFAULT_SOCKET_PATH; string socketPath = settings.nixStateDir + DEFAULT_SOCKET_PATH;