aboutsummaryrefslogtreecommitdiffstats
path: root/ruby.c
diff options
context:
space:
mode:
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/ruby.c b/ruby.c
index b21a32638b..feae61da64 100644
--- a/ruby.c
+++ b/ruby.c
@@ -1899,7 +1899,13 @@ open_load_file(VALUE fname_v, int *xflag)
#endif
if ((fd = rb_cloexec_open(fname, mode, 0)) < 0) {
- rb_load_fail(fname_v, strerror(errno));
+ int e = errno;
+ if (!rb_gc_for_fd(e)) {
+ rb_load_fail(fname_v, strerror(e));
+ }
+ if ((fd = rb_cloexec_open(fname, mode, 0)) < 0) {
+ rb_load_fail(fname_v, strerror(errno));
+ }
}
rb_update_max_fd(fd);