1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-26 04:00:59 +01:00

Merged R9217

This commit is contained in:
Wouter den Breejen 2007-10-08 14:04:55 +00:00
parent ca3d96222a
commit a94ea0fd61
6 changed files with 114 additions and 17 deletions

View file

@ -753,6 +753,8 @@ static void daemonLoop()
string socketPath = nixStateDir + DEFAULT_SOCKET_PATH;
createDirs(dirOf(socketPath));
struct sockaddr_un addr;
addr.sun_family = AF_UNIX;
if (socketPath.size() >= sizeof(addr.sun_path))
@ -762,7 +764,8 @@ static void daemonLoop()
unlink(socketPath.c_str());
/* Make sure that the socket is created with 0666 permission
(everybody can connect). */
(everybody can connect --- provided they have access to the
directory containing the socket). */
mode_t oldMode = umask(0111);
int res = bind(fdSocket, (struct sockaddr *) &addr, sizeof(addr));
umask(oldMode);