linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Another bug, in dup3
@ 2012-10-09  9:15 Richard W.M. Jones
  2012-10-09  9:25 ` Richard W.M. Jones
  0 siblings, 1 reply; 4+ messages in thread
From: Richard W.M. Jones @ 2012-10-09  9:15 UTC (permalink / raw)
  To: Al Viro, linux-fsdevel, Jim Meyering, Linus Torvalds

Al:

A second problem we noticed from the gnulib test is that this
assertion fails with the latest upstream kernel:

      /* Assigning to self is invalid.  */
      errno = 0;
      ASSERT (dup3 (fd, fd, o_flags) == -1);   <--- fails
      ASSERT (errno == EINVAL);

dup3 is not currently specified by POSIX, so technically it is fine
for dup3 on Linux to do anything it likes.

*However* the proposal for dup3 in POSIX:

  http://austingroupbugs.net/view.php?id=411

says:

  "The dup3( ) function shall be equivalent to the dup2( ) function if
  the flag argument is 0, except that it shall be an error if fildes
  is equal to fildes2."

So it's probably a good idea for Linux not to regress here.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.
http://et.redhat.com/~rjones/virt-p2v

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-10-09 14:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-09  9:15 Another bug, in dup3 Richard W.M. Jones
2012-10-09  9:25 ` Richard W.M. Jones
2012-10-09 14:27   ` [PATCH regression] dup3: Return an error when oldfd == newfd Richard W.M. Jones
2012-10-09 14:52     ` Al Viro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).