aboutsummaryrefslogtreecommitdiffstats
path: root/ext/socket/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/socket/init.c')
-rw-r--r--ext/socket/init.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/ext/socket/init.c b/ext/socket/init.c
index df32565b80..3fb436614e 100644
--- a/ext/socket/init.c
+++ b/ext/socket/init.c
@@ -358,8 +358,7 @@ rsock_socket(int domain, int type, int proto)
fd = rsock_socket0(domain, type, proto);
if (fd < 0) {
- if (errno == EMFILE || errno == ENFILE) {
- rb_gc();
+ if (rb_gc_for_fd(errno)) {
fd = rsock_socket0(domain, type, proto);
}
}