Skip to content

Commit

Permalink
darwin, freebsd: set SO_NOSIGPIPE on sockets
Browse files Browse the repository at this point in the history
Suppresses delivery of SIGPIPE signals when the remote end of the socket has
gone away.
  • Loading branch information
bnoordhuis committed Nov 22, 2012
1 parent dcd3b55 commit 90271e1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/unix/core.c
Expand Up @@ -325,6 +325,13 @@ int uv__socket(int domain, int type, int protocol) {
sockfd = -1;
}

#if defined(SO_NOSIGPIPE)
{
int on = 1;
setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, &on, sizeof(on));
}
#endif

out:
return sockfd;
}
Expand Down

0 comments on commit 90271e1

Please sign in to comment.