Date: Thu, 9 Dec 2010 20:28:30 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: cvs-src-old@freebsd.org Subject: cvs commit: src/lib/libc/stdio freopen.c Message-ID: <201012092028.oB9KSrxi035656@repoman.freebsd.org>
index | next in thread | raw e-mail
jhb 2010-12-09 20:28:30 UTC
FreeBSD src repository
Modified files:
lib/libc/stdio freopen.c
Log:
SVN rev 216334 on 2010-12-09 20:28:30Z by jhb
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().
PR: threads/79887
Submitted by: Dmitrij Tejblum tejblum of yandex-team.ru
Reviewed by: davidxu
MFC after: 1 week
Revision Changes Path
1.22 +9 -12 src/lib/libc/stdio/freopen.c
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201012092028.oB9KSrxi035656>
