Simple reproducer attached. 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
/* Test if dup3 works right. * by Richard W.M. Jones. */ #define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <assert.h> int main () { char *file = "/tmp/dup3.tmp"; int fd = creat (file, 0600); assert (fd >= 0); if (dup3 (fd, fd, 0) != -1) { fprintf (stderr, "dup3 (fd, fd, 0) didn't fail!\n"); exit (EXIT_FAILURE); } exit (EXIT_SUCCESS); }