This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] libio: Avoid dup already opened file descriptor [BZ#21393]
On Monday 22 May 2017 10:55 PM, Adhemerval Zanella wrote:
> If the operation fails, a null pointer is returned; otherwise,
> -@code{freopen} returns @var{stream}.
> +@code{freopen} returns @var{stream}. Also for Linux, due internal dup3
> +usage, it might fail with errno set to EBUSY during a race condition
> +with @code{open} and @code{dup}.
On Linux, @code{freopen} may fail and set @code{errno} to @{EBUSY} when
the kernel structure for the old file descriptor was not initialized
completely before @code{freopen} was called.
OK with that change.
Siddhesh