summaryrefslogtreecommitdiff
path: root/ext/socket/socket.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-06-21 20:19:07 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-06-21 20:19:07 +0000
commit84438a5cc3147b48bca03e1a5c00751f79193f0e (patch)
treed1b745f22c719e3117b57f05c98ce7495cedd79c /ext/socket/socket.c
parent1b5d98f3aa0405215cc6a63e165fa2c44e5823c9 (diff)
* ext/socket/socket.c (sock_s_socketpair): try GC only once.
[ruby-dev:28778] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/socket.c')
-rw-r--r--ext/socket/socket.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index 80a271baaf..1a7c6ab085 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -2304,15 +2304,17 @@ sock_s_socketpair(klass, domain, type, protocol)
VALUE klass, domain, type, protocol;
{
#if defined HAVE_SOCKETPAIR
- int d, t, sp[2];
+ int d, t, p, sp[2];
+ int ret;
setup_domain_and_type(domain, &d, type, &t);
- again:
- if (socketpair(d, t, NUM2INT(protocol), sp) < 0) {
- if (errno == EMFILE || errno == ENFILE) {
- rb_gc();
- goto again;
- }
+ p = NUM2INT(protocol);
+ ret = socketpair(d, t, p, sp);
+ if (ret < 0 && (errno == EMFILE || errno == ENFILE)) {
+ rb_gc();
+ ret = socketpair(d, t, p, sp);
+ }
+ if (ret < 0) {
rb_sys_fail("socketpair(2)");
}