aboutsummaryrefslogtreecommitdiffstats
path: root/dir.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-10-21 07:40:50 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-10-21 07:40:50 +0000
commit78e5e7305bb712a1be1fe9a509d278945454ff2b (patch)
treef97e7b6bf82cfec7119a96f75bf0468206496308 /dir.c
parent87265028dd71d12c1c0a2b002ba50ddc3dc55eb0 (diff)
downloadruby-78e5e7305bb712a1be1fe9a509d278945454ff2b.tar.gz
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
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/dir.c b/dir.c
index 92b795fbf5..cf4daeecf1 100644
--- a/dir.c
+++ b/dir.c
@@ -2689,14 +2689,13 @@ rb_dir_s_empty_p(VALUE obj, VALUE dirname)
dir = opendir(path);
if (!dir) {
int e = errno;
- switch (e) {
- case EMFILE: case ENFILE:
- rb_gc();
+ switch (rb_gc_for_fd(e)) {
+ default:
dir = opendir(path);
if (dir) break;
e = errno;
/* fall through */
- default:
+ case 0:
if (false_on_notdir && e == ENOTDIR) return Qfalse;
rb_syserr_fail_path(e, orig);
}