aboutsummaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/openssl/ossl_bio.c4
-rw-r--r--ext/pty/pty.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/ext/openssl/ossl_bio.c b/ext/openssl/ossl_bio.c
index da63c722e5..a11c08c1a3 100644
--- a/ext/openssl/ossl_bio.c
+++ b/ext/openssl/ossl_bio.c
@@ -25,10 +25,10 @@ ossl_obj2bio(VALUE obj)
GetOpenFile(obj, fptr);
rb_io_check_readable(fptr);
- if ((fd = dup(FPTR_TO_FD(fptr))) < 0){
+ if ((fd = rb_cloexec_dup(FPTR_TO_FD(fptr))) < 0){
rb_sys_fail(0);
}
- rb_fd_set_cloexec(fd);
+ rb_update_max_fd(fd);
if (!(fp = fdopen(fd, "r"))){
close(fd);
rb_sys_fail(0);
diff --git a/ext/pty/pty.c b/ext/pty/pty.c
index 032b2462d0..ac023f70c3 100644
--- a/ext/pty/pty.c
+++ b/ext/pty/pty.c
@@ -603,10 +603,10 @@ pty_getpty(int argc, VALUE *argv, VALUE self)
rfptr->pathv = rb_obj_freeze(rb_str_new_cstr(SlaveName));
wfptr->mode = rb_io_mode_flags("w") | FMODE_SYNC;
- wfptr->fd = dup(info.fd);
+ wfptr->fd = rb_cloexec_dup(info.fd);
if (wfptr->fd == -1)
rb_sys_fail("dup()");
- rb_fd_set_cloexec(wfptr->fd);
+ rb_update_max_fd(wfptr->fd);
wfptr->pathv = rfptr->pathv;
res = rb_ary_new2(3);