From f6a233057f0329372374129f06ad4d9815a3fa8e Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 1 Apr 2002 08:31:49 +0000 Subject: * io.c (rb_io_fptr_cleanup): need flush even when io will not be closed. * io.c (rb_io_initialize): was calling wrong function rb_io_mode_flags(). git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@2316 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/socket/socket.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'ext/socket') diff --git a/ext/socket/socket.c b/ext/socket/socket.c index b3cdf6248..cc76bec78 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -186,7 +186,6 @@ init_sock(sock, fd) fp->f = rb_fdopen(fd, "r"); #ifdef NT fp->finalize = sock_finalize; -#else #endif fp->f2 = rb_fdopen(fd, "w"); fp->mode = FMODE_READWRITE; @@ -199,7 +198,13 @@ static VALUE bsock_s_for_fd(klass, fd) VALUE klass, fd; { - return init_sock(rb_obj_alloc(klass), NUM2INT(fd)); + OpenFile *fptr; + VALUE sock = init_sock(rb_obj_alloc(klass), NUM2INT(fd)); + + GetOpenFile(sock, fptr); + fptr->mode |= FMODE_FDOPEN; + + return sock; } static VALUE -- cgit