diff options
author | (no author) <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-02-15 07:31:51 +0000 |
---|---|---|
committer | (no author) <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-02-15 07:31:51 +0000 |
commit | 336348328c07b663c09eff79c40e4d9dd363b607 (patch) | |
tree | 86cdfce906bcc995c55e83a907f9d9f7be071da0 /ext/socket/socket.c | |
parent | 62e648e148b3cb9f96dcce808c55c02b7ccb4486 (diff) |
This commit was manufactured by cvs2svn to create tag
'v1_3_1_990215'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v1_3_1_990215@403 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/socket.c')
-rw-r--r-- | ext/socket/socket.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/ext/socket/socket.c b/ext/socket/socket.c index e9bdbc9e8c..875c8aa5fb 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -96,6 +96,8 @@ sock_new(class, fd) fp->f = rb_fdopen(fd, "r"); #ifdef NT fp->finalize = sock_finalize; +#else + fd = dup(fd); #endif fp->f2 = rb_fdopen(fd, "w"); fp->mode = FMODE_READWRITE; @@ -140,11 +142,13 @@ bsock_close_read(sock) rb_secure(4); GetOpenFile(sock, fptr); + shutdown(fileno(fptr->f), 0); if (fptr->f2 == 0) { return rb_io_close(sock); } - if (shutdown(fileno(fptr->f), 0) == -1) - rb_sys_fail(0); +#ifdef USE_THREAD + rb_thread_fd_close(fileno(fptr->f)); +#endif fptr->mode &= ~FMODE_READABLE; #ifdef NT free(fptr->f); @@ -168,8 +172,7 @@ bsock_close_write(sock) if (fptr->f2 == 0) { return rb_io_close(sock); } - if (shutdown(fileno(fptr->f), 1) == -1) - rb_sys_fail(0); + shutdown(fileno(fptr->f2), 1); fptr->mode &= ~FMODE_WRITABLE; #ifdef NT free(fptr->f2); |