[ruby-cvs:50515] nobu:r43373 (trunk): io.c: make IO#reopen("pathname") atomic

nobu at ruby-lang.org nobu at ruby-lang.org
Sun Oct 20 15:41:25 JST 2013


nobu	2013-10-20 15:41:24 +0900 (Sun, 20 Oct 2013)

  New Revision: 43373

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=43373

  Log:
    io.c: make IO#reopen("pathname") atomic
    
    * io.c (rb_io_reopen): create a new, temporary FD via rb_sysopen and
      call rb_cloexec_dup2 on it to atomically replace the file fptr->fd
      points to.  This leaves no possible window where fptr->fd is invalid
      to userspace (even for any threads running w/o GVL).  based on the
      patch by Eric Wong <normalperson at yhbt.net> at [ruby-core:57943].
      [Bug #9036]

  Modified files:
    trunk/ChangeLog
    trunk/io.c


More information about the ruby-cvs mailing list