summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/io.c b/io.c
index 751a5ef393..4e3f60c982 100644
--- a/io.c
+++ b/io.c
@@ -369,7 +369,7 @@ io_gets_method(argc, argv, io)
VALUE rs;
if (argc == 0) {
- return io_gets(io);
+ rs = RS;
}
else {
rb_scan_args(argc, argv, "1", &rs);
@@ -394,7 +394,6 @@ io_gets_method(argc, argv, io)
rsptr = 0;
rslen = 0;
}
- newline = rslen ? rsptr[rslen - 1] : 0777;
GetOpenFile(io, fptr);
io_readable(fptr);
@@ -413,6 +412,7 @@ io_gets_method(argc, argv, io)
} while (c != EOF);
}
+ newline = rslen ? rsptr[rslen - 1] : 0777;
{
char buf[8192];
char *bp, *bpe = buf + sizeof buf - 3;