summaryrefslogtreecommitdiffstats
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
commit15eb607c1c0803812050a50fc7dcfb9f456ff3b2 (patch)
tree826107ddf61a637dcb32d60f334bf56c27d72dc1 /io.c
parent7424833158ab053790f4e23ac1c4a5178eadbbdb (diff)
downloadruby-15eb607c1c0803812050a50fc7dcfb9f456ff3b2.tar.gz
ruby-15eb607c1c0803812050a50fc7dcfb9f456ff3b2.tar.xz
ruby-15eb607c1c0803812050a50fc7dcfb9f456ff3b2.zip
19990922
git-svn-id: http://svn.ruby-lang.org/repos/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 3aa95e2ca..c1c7d511d 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));
}