diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-06-26 14:15:49 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-06-26 14:15:49 +0000 |
commit | e5f2b421c0b5134a58a4cf45234f54c376fd1297 (patch) | |
tree | 7676dfcfd62aa77f8b3ca1b885d4183b4adcda13 /ext/socket/socket.c | |
parent | 6fa7d6cb014334082f020e57c248de6ea4a30b94 (diff) | |
download | ruby-e5f2b421c0b5134a58a4cf45234f54c376fd1297.tar.gz |
* ext/socket/socket.c (sock_accept): revert to avoid ambiguity of
argument evaluation order. [ruby-dev:28861]
* ext/socket/socket.c (sock_accept_nonblock): ditto.
* io.c (pipe_open): avoid closing uninitialized file descriptors.
a patch from <tommy at tmtm.org> [ruby-dev:28600]
* parse.y: replace terminal token names with more descriptive
name, i.e. kEND to keyword_end. [ruby-list:42477]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/socket.c')
-rw-r--r-- | ext/socket/socket.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/ext/socket/socket.c b/ext/socket/socket.c index 233bb0a644..3c91ec472a 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -2815,15 +2815,18 @@ sock_recvfrom_nonblock(int argc, VALUE *argv, VALUE sock) } static VALUE -sock_accept(VALUE sock) +sock_accept(sock) + VALUE sock; { OpenFile *fptr; + VALUE sock2; char buf[1024]; socklen_t len = sizeof buf; GetOpenFile(sock, fptr); - return rb_assoc_new(s_accept(rb_cSocket,fptr->fd,(struct sockaddr*)buf, &len), - rb_str_new(buf, len)); + sock2 = s_accept(rb_cSocket,fptr->fd,(struct sockaddr*)buf,&len); + + return rb_assoc_new(sock2, rb_str_new(buf, len)); } /* @@ -2875,16 +2878,17 @@ sock_accept(VALUE sock) * * Socket#accept */ static VALUE -sock_accept_nonblock(VALUE sock) +sock_accept_nonblock(sock) + VALUE sock; { OpenFile *fptr; + VALUE sock2; char buf[1024]; socklen_t len = sizeof buf; GetOpenFile(sock, fptr); - return rb_assoc_new(s_accept_nonblock(rb_cSocket, fptr, - (struct sockaddr *)buf, &len), - rb_str_new(buf, len)); + sock2 = s_accept_nonblock(rb_cSocket, fptr, (struct sockaddr *)buf, &len); + return rb_assoc_new(sock2, rb_str_new(buf, len)); } /* |