[PATCH] libio: Avoid dup already opened file descriptor [BZ#21393]
Adhemerval Zanella
adhemerval.zanella@linaro.org
Mon May 22 20:26:00 GMT 2017
On 22/05/2017 17:25, Zack Weinberg wrote:
> "This can only happen in multi-threaded programs, when two threads
> race to allocate the same file descriptor number. To avoid the
> possibility of this race, do not use @code{close} to close the
> underlying file descriptor for a @code{FILE}; either use
> @code{freopen} while the file is still open, or use @code{open} and
> then @code{dup2} to install the new file descriptor."
Ack, I will add it as well.
More information about the Libc-alpha
mailing list