dir.c: use rb_gc_for_fd
* dir.c (rb_dir_s_empty_p): use rb_gc_for_fd for the condition to invoke GC by errno. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1e09d98b23
commit
9590e99031
7
dir.c
7
dir.c
@ -2689,14 +2689,13 @@ rb_dir_s_empty_p(VALUE obj, VALUE dirname)
|
|||||||
dir = opendir(path);
|
dir = opendir(path);
|
||||||
if (!dir) {
|
if (!dir) {
|
||||||
int e = errno;
|
int e = errno;
|
||||||
switch (e) {
|
switch (rb_gc_for_fd(e)) {
|
||||||
case EMFILE: case ENFILE:
|
default:
|
||||||
rb_gc();
|
|
||||||
dir = opendir(path);
|
dir = opendir(path);
|
||||||
if (dir) break;
|
if (dir) break;
|
||||||
e = errno;
|
e = errno;
|
||||||
/* fall through */
|
/* fall through */
|
||||||
default:
|
case 0:
|
||||||
if (false_on_notdir && e == ENOTDIR) return Qfalse;
|
if (false_on_notdir && e == ENOTDIR) return Qfalse;
|
||||||
rb_syserr_fail_path(e, orig);
|
rb_syserr_fail_path(e, orig);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user