1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@2316 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2002-04-01 08:31:49 +00:00
parent 360453ce14
commit de373b1b6c
5 changed files with 23 additions and 5 deletions

View file

@ -1,3 +1,11 @@
Mon Apr 1 17:25:50 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
* 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().
Mon Apr 1 16:52:00 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
* ext/sdbm/init.c (each_pair): moved prototype before the

View file

@ -200,7 +200,7 @@ static struct types {
T_FALSE, "false",
T_SYMBOL, "Symbol", /* :symbol */
T_DATA, "Data", /* internal use: wrapped C pointers */
T_MATCH, "Match", /* data of $~ */
T_MATCH, "MatchData", /* data of $~ */
T_VARMAP, "Varmap", /* internal use: dynamic variables */
T_SCOPE, "Scope", /* internal use: variable scope */
T_NODE, "Node", /* internal use: syntax tree node */

View file

@ -253,6 +253,8 @@ racc_yyparse(parser, recv, mid, arg, indebug)
return v->retval;
}
static VALUE call_scaniter _((VALUE));
static VALUE
call_scaniter(data)
VALUE data;

View file

@ -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

7
io.c
View file

@ -1194,7 +1194,10 @@ rb_io_fptr_cleanup(fptr, fin)
OpenFile *fptr;
int fin;
{
if (fptr->mode & FMODE_FDOPEN) return;
if (fptr->mode & FMODE_FDOPEN) {
io_fflush(GetWriteFile(fptr), fptr);
return;
}
if (fptr->finalize) {
(*fptr->finalize)(fptr);
}
@ -2609,7 +2612,7 @@ rb_io_initialize(argc, argv, io)
fd = NUM2INT(fnum);
if (argc == 2) {
SafeStringValue(mode);
flags = rb_io_mode_flags(RSTRING(mode)->ptr);
flags = rb_io_mode_modenum(RSTRING(mode)->ptr);
}
else {
#if defined(HAVE_FCNTL) && defined(F_GETFL)