summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-05-01 22:07:46 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2021-05-10 15:59:23 +0900
commit2d670274481647bf3bc9c82a9472bc8500a97a45 (patch)
treea902dbeba46e56f28631abb80249ecf0beba9d12 /io.c
parent1d0e670e91a379bb276815014e9879a9aa9b6551 (diff)
Removed missing/dup2.c
This function should be always available, as POSIX-compliant or Windows platform are required since 1.9. Also the code in this file is MT-unsafe.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4483
Diffstat (limited to 'io.c')
-rw-r--r--io.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/io.c b/io.c
index 371d6cef20..32b367fc2f 100644
--- a/io.c
+++ b/io.c
@@ -462,7 +462,7 @@ rb_cloexec_fcntl_dupfd(int fd, int minfd)
}
#elif defined(HAVE_FCNTL) && defined(F_DUPFD)
ret = fcntl(fd, F_DUPFD, minfd);
-#elif defined(HAVE_DUP)
+#else
ret = dup(fd);
if (ret >= 0 && ret < minfd) {
const int prev_fd = ret;
@@ -470,8 +470,6 @@ rb_cloexec_fcntl_dupfd(int fd, int minfd)
close(prev_fd);
}
return ret;
-#else
-# error "dup() or fcntl(F_DUPFD) must be supported."
#endif
if (ret < 0) return ret;
rb_maygvl_fd_fix_cloexec(ret);