From 526c89a6d4fea76b714de4b0af943c95af9e0abc Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 21 Oct 2016 07:06:27 +0000 Subject: ruby.c: retry loading with GC * ruby.c (open_load_file): retry after GC when the limit for open file descriptors reached. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ruby.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'ruby.c') 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); -- cgit v1.2.3