aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/io.c b/io.c
index 9f1550812a..2404b1faf5 100644
--- a/io.c
+++ b/io.c
@@ -1083,7 +1083,7 @@ rb_io_ungetc(io, c)
GetOpenFile(io, fptr);
rb_io_check_readable(fptr);
- if (ungetc(cc, fptr->f) == EOF)
+ if (ungetc(cc, fptr->f) == EOF && cc != EOF)
rb_sys_fail(fptr->path);
return Qnil;
}