diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-09-27 23:12:43 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-09-27 23:12:43 +0000 |
commit | a9280ca7c91c38b5135ca63ae0bbdb669e589f28 (patch) | |
tree | 51b90607e1ceabef81263c5aba4ec7acffa5c7d3 /io.c | |
parent | 7567345876e063a9d65d259dcc86516a43be090c (diff) |
* io.c (read_buffered_data): check if reached EOF. fixed: [ruby-dev:27334]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -1020,8 +1020,10 @@ read_buffered_data(ptr, len, f) if (n > len) n = len; return fread(ptr, 1, n, f); #else - for (n = 0; n < len && READ_DATA_PENDING(f); ++n) { - *ptr++ = getc(f); + int c; + + for (n = 0; n < len && READ_DATA_PENDING(f) && (c = getc(f)) != EOF; ++n) { + *ptr++ = c; } return n; #endif |