summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-22 09:48:19 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-22 09:48:19 +0000
commit930729e6951dedc581a7a17b0ff5e062a7fca7fb (patch)
tree4bf857e8e6afbaceb07a4d2de4c9f70f73bd0a17 /io.c
parentc6b4cb122ea234c11acb5b6eed12c54daa18582b (diff)
merges r22099 from trunk into ruby_1_9_1.
* io.c (io_fread): use rb_io_wait_readable for retry avoid Errno::EINTR on ruby -e 'trap(:CHLD) {}; spawn("sleep 1"); STDIN.read' git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@22518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/io.c b/io.c
index 7a9695c379..50eaa5f261 100644
--- a/io.c
+++ b/io.c
@@ -1428,12 +1428,15 @@ io_fread(VALUE str, long offset, rb_io_t *fptr)
if (READ_DATA_PENDING(fptr) == 0) {
while (n > 0) {
+ again:
c = rb_read_internal(fptr->fd, RSTRING_PTR(str)+offset, n);
if (c == 0) {
io_set_eof(fptr);
break;
}
if (c < 0) {
+ if (rb_io_wait_readable(fptr->fd))
+ goto again;
rb_sys_fail_path(fptr->pathv);
}
offset += c;