summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-29 05:27:32 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-29 05:27:32 +0000
commitbaa2d74daea424a7e28cf659e9d3a1fd05a7ff3e (patch)
tree0ed1ce12498cfed595ff304d3b4273ef9397d9e4
parentda74bc75523ef4054030e5f3cf4aac3e9bfe8715 (diff)
* io.c (rb_cloexec_open): use O_CLOEXEC if available.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--io.c3
2 files changed, 7 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 1470ff6bbe..fd015593cd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Sat Oct 29 14:26:56 2011 Tanaka Akira <akr@fsij.org>
+
+ * io.c (rb_cloexec_open): use O_CLOEXEC if available.
+
Sat Oct 29 12:57:15 2011 Tanaka Akira <akr@fsij.org>
* process.c (ruby_setsid): use rb_cloexec_open.
diff --git a/io.c b/io.c
index 806d095139..98484e8958 100644
--- a/io.c
+++ b/io.c
@@ -191,6 +191,9 @@ int
rb_cloexec_open(const char *pathname, int flags, mode_t mode)
{
int ret;
+#ifdef O_CLOEXEC
+ flags |= O_CLOEXEC;
+#endif
ret = open(pathname, flags, mode);
if (ret == -1) return -1;
fd_set_cloexec(ret);