aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/io.c b/io.c
index 7a0bf4935c..8dabdbcc9a 100644
--- a/io.c
+++ b/io.c
@@ -297,8 +297,10 @@ rb_cloexec_fcntl_dupfd(int fd, int minfd)
}
/* F_DUPFD_CLOEXEC is available since Linux 2.6.24. Linux 2.6.18 fails with EINVAL */
if (errno == EINVAL) {
- try_dupfd_cloexec = 0;
ret = fcntl(fd, F_DUPFD, minfd);
+ if (ret != -1) {
+ try_dupfd_cloexec = 0;
+ }
}
}
else {