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

The following reply was made to PR lib/45148; it has been noted by GNATS.

From: David Holland <>
Subject: Re: lib/45148: dup2(3) and dup3(3) should support EINVAL
Date: Sun, 17 Jul 2011 03:24:14 +0000

 On Fri, Jul 15, 2011 at 08:50:04AM +0000, Jukka Ruohonen wrote:
  >  >  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.
 dup3 should be a superset of dup2, IOW, dup2(a, b) === dup3(a, b, 0).
 Anything else is insane and begging for bizarre problems in the future.
 David A. Holland

Home | Main Index | Thread Index | Old Index