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

Siddhesh Poyarekar siddhesh@gotplt.org
Thu May 18 20:00:00 GMT 2017


On Friday 19 May 2017 01:13 AM, Adhemerval Zanella wrote:
> I think for BZ#21393 we won't get any sufficient conforming implementation
> with proper kernel help or without relaxing the POSIX definition to also
> allow this kind of errno.  So I still think that checking for EBUSY and
> returning it is still the correct approach.  Specially because for the cases 
> where it fails then application might still seeing spurious issue due freopen
> returning a valid return code but without dupping correctly the file
> descriptor.

OK, then this would require a NEWS item declaring that freopen behaviour
is fixed and that its failure can now also set errno as EBUSY.  Maybe
the man page needs updating as well.

> Also I think for proper underlying kernel support it would potentially
> require dup3 to indefinitely block (which still be even more troublesome due
> underlying FS like NFS that might timeout).  I would require to extend dup3
> semantic, possible making it a cancelable entrypoint, and imho I think kernel
> won't take this path lightly.

They don't.

Siddhesh



More information about the Libc-alpha mailing list