summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--io.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 9e3f5806af..cfea8f3132 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sun Oct 30 08:29:51 2011 Tanaka Akira <akr@fsij.org>
+
+ * io.c (rb_cloexec_dup2): don't set CLOEXEC for standard file
+ descriptors.
+
Sun Oct 30 07:47:10 2011 Tanaka Akira <akr@fsij.org>
* configure.in: check dup3.
diff --git a/io.c b/io.c
index 5bec3622f4..1e04a1d6f5 100644
--- a/io.c
+++ b/io.c
@@ -234,7 +234,7 @@ rb_cloexec_dup2(int oldfd, int newfd)
#if defined(HAVE_DUP3) && defined(O_CLOEXEC)
static int try_dup3 = 1;
- if (try_dup3) {
+ if (2 < newfd && try_dup3) {
ret = dup3(oldfd, newfd, O_CLOEXEC);
/* dup3 is available since Linux 2.6.27. */
if (ret == -1 && errno == ENOSYS) {