summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-27 11:43:34 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-27 11:43:34 +0000
commit09ae127bade1d58705adfccb09a70403d8d909d5 (patch)
treed36d75039304db76e6a6fa623527094d5a8a50ce /io.c
parentf2502cec8afb9b35a41dcd1cd81348ec4197de46 (diff)
io.c: fix race between read and close
* io.c (io_fillbuf): fix race between read and close and bail out in the case the IO gets closed before the reading thread achieve the lock. [ruby-core:78845] [Bug #13076] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/io.c b/io.c
index 2731bb829f..1074689560 100644
--- a/io.c
+++ b/io.c
@@ -1775,6 +1775,7 @@ io_fillbuf(rb_io_t *fptr)
rb_syserr_fail_path(e, path);
}
}
+ if (r > 0) rb_io_check_closed(fptr);
fptr->rbuf.off = 0;
fptr->rbuf.len = (int)r; /* r should be <= rbuf_capa */
if (r == 0)