summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--ext/socket/init.c10
2 files changed, 14 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 37858c2..a748fd6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Nov 3 22:12:41 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * ext/socket/init.c (rsock_socket): set close-on-exec flag when
+ SOCK_CLOEXEC is not available.
+
Thu Nov 03 08:36:00 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
* test/openssl/test_engine.rb: call Engine::cleanup on exit.
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;
}