summaryrefslogtreecommitdiff
path: root/ext/socket/unixsocket.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-31 22:32:49 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-31 22:32:49 +0000
commit7ae60a6b0d529ba04b8b59d3e5a58320a54b5878 (patch)
tree8c7cfbe03fbcb3b3b5d93fb53d997f9d40497fce /ext/socket/unixsocket.c
parentee5ae134dd1c0037a36b2e0c78cd4e326d002c3a (diff)
* ext/socket/ancdata.c (nogvl_recvmsg_func): use MSG_CMSG_CLOEXEC if
available. * ext/socket/unixsocket.c (recvmsg_blocking): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/unixsocket.c')
-rw-r--r--ext/socket/unixsocket.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/socket/unixsocket.c b/ext/socket/unixsocket.c
index cd4dd7b..e5ef44c 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);
}
/*