ruby-changes:45151
From: nobu <ko1@a...>
Date: Tue, 27 Dec 2016 20:43:37 +0900 (JST)
Subject: [ruby-changes:45151] nobu:r57224 (trunk): io.c: fix race between read and close
nobu 2016-12-27 20:43:34 +0900 (Tue, 27 Dec 2016) New Revision: 57224 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57224 Log: 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] Modified files: trunk/io.c Index: io.c =================================================================== --- io.c (revision 57223) +++ io.c (revision 57224) @@ -1775,6 +1775,7 @@ io_fillbuf(rb_io_t *fptr) https://github.com/ruby/ruby/blob/trunk/io.c#L1775 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) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/