file.c: rb_file_load_ok: GC+retry on EMFILE/ENFILE/ENOMEM
`require' should make a best effort to avoid failure on recoverable resource exhaustion errors.
This commit is contained in:
parent
15ef2b2d7c
commit
3376eca80a
6
file.c
6
file.c
@ -6374,7 +6374,11 @@ rb_file_load_ok(const char *path)
|
|||||||
#endif
|
#endif
|
||||||
0);
|
0);
|
||||||
int fd = rb_cloexec_open(path, mode, 0);
|
int fd = rb_cloexec_open(path, mode, 0);
|
||||||
if (fd == -1) return 0;
|
if (fd < 0) {
|
||||||
|
if (!rb_gc_for_fd(errno)) return 0;
|
||||||
|
fd = rb_cloexec_open(path, mode, 0);
|
||||||
|
if (fd < 0) return 0;
|
||||||
|
}
|
||||||
rb_update_max_fd(fd);
|
rb_update_max_fd(fd);
|
||||||
ret = ruby_is_fd_loadable(fd);
|
ret = ruby_is_fd_loadable(fd);
|
||||||
(void)close(fd);
|
(void)close(fd);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user