summaryrefslogtreecommitdiff
path: root/ext/socket/socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/socket/socket.c')
-rw-r--r--ext/socket/socket.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index 2f282b8e34..0514bb6502 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -241,8 +241,7 @@ rsock_socketpair(int domain, int type, int protocol, int sv[2])
int ret;
ret = rsock_socketpair0(domain, type, protocol, sv);
- if (ret < 0 && (errno == EMFILE || errno == ENFILE)) {
- rb_gc();
+ if (ret < 0 && rb_gc_for_fd(errno)) {
ret = rsock_socketpair0(domain, type, protocol, sv);
}