diff options
Diffstat (limited to 'ext/socket/unixsocket.c')
-rw-r--r-- | ext/socket/unixsocket.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/socket/unixsocket.c b/ext/socket/unixsocket.c index cd4dd7b05f..e5ef44c93e 100644 --- a/ext/socket/unixsocket.c +++ b/ext/socket/unixsocket.c @@ -264,7 +264,12 @@ static VALUE recvmsg_blocking(void *data) { struct iomsg_arg *arg = data; - return recvmsg(arg->fd, &arg->msg, 0); + int flags = 0; +#ifdef MSG_CMSG_CLOEXEC + /* MSG_CMSG_CLOEXEC is available since Linux 2.6.23. Linux 2.6.18 silently ignore it. */ + flags |= MSG_CMSG_CLOEXEC; +#endif + return recvmsg(arg->fd, &arg->msg, flags); } /* |