Re: Another bug, in dup3

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

 



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);
}

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux