summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/io.c b/io.c
index 19690ddc4d..87caa7651f 100644
--- a/io.c
+++ b/io.c
@@ -1315,6 +1315,7 @@ rb_io_ungetc(io, c)
GetOpenFile(io, fptr);
rb_io_check_readable(fptr);
+ flush_before_seek(fptr);
if (ungetc(cc, fptr->f) == EOF && cc != EOF)
rb_sys_fail(fptr->path);