[Midnightbsd-cvs] src: freopen.c: When reopening a stream backed by an open file

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Thu Dec 9 19:52:06 EST 2010


Log Message:
-----------
When reopening a stream backed by an open file descriptor, do not close
  the existing file descriptor.  Instead, let dup2() atomically close the
  old file descriptor when assigning the newly opened file to the same
  descriptor.  This closes a race in a multithreaded application where a
  concurrent open() could allocate the existing file descriptor in between
  the calls to close() and dup2().

Obtained from: FreeBSD

Modified Files:
--------------
    src/lib/libc/stdio:
        freopen.c (r1.1.1.2 -> r1.2)
        (http://cvsweb.midnightbsd.org/src/lib/libc/stdio/freopen.c?r1=1.1.1.2&r2=1.2)


More information about the Midnightbsd-cvs mailing list