summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-23 22:50:53 (GMT)
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-23 22:50:53 (GMT)
commit61e5fe06748de67e1d198a4d28d1e59e5c1dcedc (patch)
tree852db959a59e6a0901a691f7560a58ed25386c7b /dir.c
parenta936bd5c63e96535be85c965260fbd45db1a3c58 (diff)
use rb_gc_for_fd for more callers
* dir.c (dir_initialize): use rb_gc_for_fd for ENOMEM * ext/socket/init.c (rsock_socket): ditto * ext/socket/socket.c (rsock_socketpair): ditto * internal.h (rb_gc_for_fd): prototype * io.c (rb_gc_for_fd): remove static [ruby-core:71623] [Feature #11727] Manpages for opendir(2), socket(2), and socketpair(3posix) describe ENOMEM as a possible error for each of these; handle it consistently with our existing wrappers for open(2)/pipe(2) etc... git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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 05ad656..70e9bbd 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