NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lib/45148: dup2(3) and dup3(3) should support EINVAL



On Fri, Jul 15, 2011 at 08:45:01AM +0000, Martin Husemann wrote:
>  On Fri, Jul 15, 2011 at 08:30:00AM +0000, Jukka Ruohonen wrote:
>  > In Linux the dup3(3) call fails with EINVAL (a) if the specified flags
>  > contain an invalid value or (b) if "newfd" equals "oldfd". The case (b)
>  > applies also to dup2(3).
>  
>  I don't think so:
>  
>  the open group base spec issue 7 says:
>  
>    If fildes2 is already a valid open file descriptor, it shall be closed
>    first, unless fildes is equal to fildes2 in which case dup2() shall
>    return fildes2 without closing it.
>  
>  Our dup2(3) man page has weaker words, but to the same effect.

Yes, however dup3(2) is not standardized, AFAIR, leaving the behavior
"undefined". And the case (a) should still apply.

- Jukka.


Home | Main Index | Thread Index | Old Index