diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-06-21 20:19:07 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-06-21 20:19:07 +0000 |
commit | 9dddfc2dc374838f1e728fe8eecd9f607f059b6e (patch) | |
tree | f65c81c9074d55dabd5e4bc5cd258eac39ae968d /ext/socket | |
parent | 8db049f856a4d584db0e1b45b988ad6750d803c5 (diff) | |
download | ruby-9dddfc2dc374838f1e728fe8eecd9f607f059b6e.tar.gz ruby-9dddfc2dc374838f1e728fe8eecd9f607f059b6e.tar.xz ruby-9dddfc2dc374838f1e728fe8eecd9f607f059b6e.zip |
* ext/socket/socket.c (sock_s_socketpair): try GC only once.
[ruby-dev:28778]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@10362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket')
-rw-r--r-- | ext/socket/socket.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/ext/socket/socket.c b/ext/socket/socket.c index 9caa255c6..233bb0a64 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)"); } |