summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-03-03 05:17:39 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-03-03 05:17:39 +0000
commit6a6d0ad22009c437217eb6aeb4c3750f7a3aaa6d (patch)
tree4ab0fd67ef12ea789ccb12df06654057f5ee6f87 /io.c
parent0cd0eab641a16d6e59f424ab3f5fad3550fa54b5 (diff)
* parse.y (arg): parse 'lhs = a rescue b' as 'lhs=(a rescue b)'.
* io.c (rb_io_fread): should not clearerr() if there's no filled buffer (i.e. rb_io_fread() returning zero). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/io.c b/io.c
index 2f47e5f818..4865b7ce79 100644
--- a/io.c
+++ b/io.c
@@ -710,8 +710,10 @@ rb_io_fread(ptr, len, f)
#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
case EWOULDBLOCK:
#endif
- clearerr(f);
- return len - n;
+ if (len - n > 0) {
+ clearerr(f);
+ return len - n;
+ }
}
return 0;
}