summaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-06-26 18:24:58 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-06-26 18:24:58 +0000
commita84ddb4b6f91253a0f253eeed2ce31efa8467dae (patch)
tree3ba10893d2e9cca6d1a2b197e191bd1ea1eb208d /io.c
parentcc1b253ff70f09aae5bb911001933741ff00e90a (diff)
downloadruby-a84ddb4b6f91253a0f253eeed2ce31efa8467dae.tar.gz
ruby-a84ddb4b6f91253a0f253eeed2ce31efa8467dae.tar.xz
ruby-a84ddb4b6f91253a0f253eeed2ce31efa8467dae.zip
* io.c (io_fflush): need to check if closed after thread switch.
[ruby-dev:20351] * io.c (fptr_finalize): ditto. * string.c (rb_str_rindex_m): fixed wrong fix. should move backward first only when matching from the end. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@4006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/io.c b/io.c
index 956d69851..a3b7fa78a 100644
--- a/io.c
+++ b/io.c
@@ -301,7 +301,9 @@ io_fflush(f, fptr)
{
int n;
- rb_thread_fd_writable(fileno(f));
+ if (!rb_thread_fd_writable(fileno(f))) {
+ rb_io_check_closed(fptr);
+ }
for (;;) {
TRAP_BEG;
n = fflush(f);
@@ -1331,6 +1333,7 @@ fptr_finalize(fptr, noraise)
e = errno;
break;
}
+ if (!fptr->f2) break;
}
fptr->f2 = 0;
}
@@ -1339,6 +1342,7 @@ fptr_finalize(fptr, noraise)
while ((n1 = fclose(fptr->f)) < 0) {
if (f2 != -1 || !(fptr->mode & FMODE_WBUF)) break;
if (!rb_io_wait_writable(f1)) break;
+ if (!fptr->f) break;
}
fptr->f = 0;
if (n1 < 0 && errno == EBADF && f1 == f2) {