summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/io.c b/io.c
index 6520ce4925..8057542f92 100644
--- a/io.c
+++ b/io.c
@@ -1195,7 +1195,9 @@ rb_io_fptr_cleanup(fptr, fin)
int fin;
{
if (fptr->mode & FMODE_FDOPEN) {
- io_fflush(GetWriteFile(fptr), fptr);
+ if (fptr->mode & FMODE_WRITABLE) {
+ io_fflush(GetWriteFile(fptr), fptr);
+ }
return;
}
if (fptr->finalize) {