summaryrefslogtreecommitdiff
path: root/gl/dup2.c
diff options
context:
space:
mode:
Diffstat (limited to 'gl/dup2.c')
-rw-r--r--gl/dup2.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gl/dup2.c b/gl/dup2.c
index db12f630aa..f1b606d9b7 100644
--- a/gl/dup2.c
+++ b/gl/dup2.c
@@ -96,7 +96,11 @@ rpl_dup2 (int fd, int desired_fd)
/* On Linux kernels 2.6.26-2.6.29, dup2 (fd, fd) returns -EBADF.
On Cygwin 1.5.x, dup2 (1, 1) returns 0.
On Cygwin 1.7.17, dup2 (1, -1) dumps core.
+ On Cygwin 1.7.25, dup2 (1, 256) can dump core.
On Haiku, dup2 (fd, fd) mistakenly clears FD_CLOEXEC. */
+# if HAVE_SETDTABLESIZE
+ setdtablesize (desired_fd + 1);
+# endif
if (desired_fd < 0)
fd = desired_fd;
if (fd == desired_fd)