F_SETFD must be supplied to fcntl() to set options

This commit is contained in:
Micke Prag 2012-12-05 11:21:13 +01:00
parent 174c31f4ca
commit bca00ef148
2 changed files with 2 additions and 2 deletions

View file

@ -66,7 +66,7 @@ void Socket::connect(const std::wstring &server) {
}
#if defined(_MACOSX)
int op = fcntl(d->socket, F_GETFD);
fcntl(d->socket, op | FD_CLOEXEC); // OS X doesn't support SOCK_CLOEXEC yet
fcntl(d->socket, F_SETFD, op | FD_CLOEXEC); // OS X doesn't support SOCK_CLOEXEC yet
#endif
std::string name = "/tmp/" + std::string(server.begin(), server.end());
remote.sun_family = AF_UNIX;

View file

@ -58,7 +58,7 @@ void ConnectionListener::run() {
}
#if defined(_MACOSX)
int op = fcntl(serverSocket, F_GETFD);
fcntl(serverSocket, op | FD_CLOEXEC); // OS X doesn't support SOCK_CLOEXEC yet
fcntl(serverSocket, F_SETFD, op | FD_CLOEXEC); // OS X doesn't support SOCK_CLOEXEC yet
#endif
name.sun_family = AF_LOCAL;
memset(name.sun_path, '\0', sizeof(name.sun_path));