]> CyberLeo.Net >> Repos - FreeBSD/stable/8.git/commit
MFC 216334:
authorjhb <jhb@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Wed, 26 Jan 2011 20:14:03 +0000 (20:14 +0000)
committerjhb <jhb@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Wed, 26 Jan 2011 20:14:03 +0000 (20:14 +0000)
commitfc7d9c8a26cad52660b9ee5cb4bc684e07549960
tree2fa6829d68c1ed301a6578d882e890d706031977
parenta743049cdebb1096a8d0f3ad5490a2c0594746a7
MFC 216334:
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().

git-svn-id: svn://svn.freebsd.org/base/stable/8@217899 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
lib/libc/stdio/freopen.c