aboutsummaryrefslogtreecommitdiffstats
path: root/dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/dir.c b/dir.c
index 05ad656fda..70e9bbd2cd 100644
--- a/dir.c
+++ b/dir.c
@@ -519,8 +519,7 @@ dir_initialize(int argc, VALUE *argv, VALUE dir)
path = RSTRING_PTR(dirname);
dp->dir = opendir(path);
if (dp->dir == NULL) {
- if (errno == EMFILE || errno == ENFILE) {
- rb_gc();
+ if (rb_gc_for_fd(errno)) {
dp->dir = opendir(path);
}
#ifdef HAVE_GETATTRLIST