This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] libio: Avoid dup already opened file descriptor [BZ#21393]



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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]