diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-06 14:46:21 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-06 14:46:21 +0000 |
commit | a0b54e6cbdb08fb0a0644e3c3b9f1a870a10f7c1 (patch) | |
tree | f9d8fe1a54f53bc0f4d6a40a4b25d105502c4579 /io.c | |
parent | 7f38c3b1a7ac88f460ab9fb29e1483622440e480 (diff) | |
download | ruby-a0b54e6cbdb08fb0a0644e3c3b9f1a870a10f7c1.tar.gz |
* 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/trunk@22099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -1442,12 +1442,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; |