summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-11-03 13:14:48 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-11-03 13:14:48 +0000
commita0b22b1a39ec127d12689de200faf4addc2b5300 (patch)
tree084ef8530c31c099ea30d580e70f868d03cc281b /ext
parent8731a38bfff493437f831ad86c07266ae615aad4 (diff)
* ext/socket/init.c (rsock_socket): set close-on-exec flag when
SOCK_CLOEXEC is not available. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33619 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/socket/init.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/ext/socket/init.c b/ext/socket/init.c
index ad25ccb..92cca7c 100644
--- a/ext/socket/init.c
+++ b/ext/socket/init.c
@@ -270,8 +270,16 @@ rsock_socket(int domain, int type0, int proto)
fd = socket(domain, type, proto);
}
}
+#ifdef SOCK_CLOEXEC
if (0 <= fd)
- rb_update_max_fd(fd);
+ if (try_sock_cloexec)
+ rb_update_max_fd(fd);
+ else
+ rb_fd_fix_cloexec(fd);
+#else
+ if (0 <= fd)
+ rb_fd_fix_cloexec(fd);
+#endif
return fd;
}