summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-01-03 15:39:10 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-01-03 15:39:10 +0000
commit0626021e13c6aaf9db1bf34a10e8186867e30901 (patch)
tree5ddf0d6c3bb79eeb8bfcce3e6d4df3684d2ba017 /io.c
parent1fe680e812e44a760b2e9bc58402c08774d5d1a0 (diff)
* io.c (rb_cloexec_fcntl_dupfd): Fix failures in
bootstrap_test/test_io.rb. NativeClient does not support F_DUPFD but supports dup2(2). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/io.c b/io.c
index f75251b10e..2bbce9f330 100644
--- a/io.c
+++ b/io.c
@@ -298,7 +298,7 @@ rb_cloexec_fcntl_dupfd(int fd, int minfd)
{
int ret;
-#if defined(HAVE_FCNTL) && defined(F_DUPFD_CLOEXEC)
+#if defined(HAVE_FCNTL) && defined(F_DUPFD_CLOEXEC) && !defined(__native_client__)
static int try_dupfd_cloexec = 1;
if (try_dupfd_cloexec) {
ret = fcntl(fd, F_DUPFD_CLOEXEC, minfd);
@@ -318,8 +318,10 @@ rb_cloexec_fcntl_dupfd(int fd, int minfd)
else {
ret = fcntl(fd, F_DUPFD, minfd);
}
-#else
+#elif defined(HAVE_FCNTL) && !defined(__native_client__)
ret = fcntl(fd, F_DUPFD, minfd);
+#else
+ ret = dup2(fd, minfd);
#endif
if (ret == -1) return -1;
rb_maygvl_fd_fix_cloexec(ret);