summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-09-22 04:30:11 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-09-22 04:30:11 +0000
commit8aad024e3ac6524f8bc09d839a331f926eab30ec (patch)
tree826107ddf61a637dcb32d60f334bf56c27d72dc1 /io.c
parent70a444b0cc703a2fd3e05045cd1e36266221149e (diff)
19990922
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/io.c b/io.c
index 3aa95e2cae..c1c7d511db 100644
--- a/io.c
+++ b/io.c
@@ -449,14 +449,15 @@ io_fread(ptr, len, f)
FILE *f;
{
size_t n = len;
+ int c;
while (n--) {
- *ptr = getc(f);
- if (*ptr == EOF) {
+ c = getc(f);
+ if (c == EOF) {
*ptr = '\0';
break;
}
- ptr++;
+ *ptr++ = c;
if (!READ_DATA_PENDING(f)) {
rb_thread_wait_fd(fileno(f));
}