summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--ext/socket/socket.c16
2 files changed, 14 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 720bbcd102..5bdc6cdc12 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Jun 22 05:15:58 2006 Tanaka Akira <akr@m17n.org>
+
+ * ext/socket/socket.c (sock_s_socketpair): try GC only once.
+ [ruby-dev:28778]
+
Wed Jun 21 21:20:31 2006 Tadayoshi Funaba <tadf@dotrb.org>
* lib/date.rb (jd_to_commercial): now works fine even if in
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index 9caa255c69..233bb0a644 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -2239,15 +2239,17 @@ static VALUE
sock_s_socketpair(VALUE klass, VALUE domain, VALUE type, VALUE 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)");
}