linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Richard W.M. Jones" <rjones@redhat.com>
To: Al Viro <viro@ZenIV.linux.org.uk>,
	linux-fsdevel@vger.kernel.org, Jim Meyering <jim@meyering.net>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: Another bug, in dup3
Date: Tue, 9 Oct 2012 10:25:50 +0100	[thread overview]
Message-ID: <20121009092549.GA19680@rhmail.home.annexia.org> (raw)
In-Reply-To: <20121009091521.GM24071@rhmail.home.annexia.org>

[-- Attachment #1: Type: text/plain, Size: 304 bytes --]

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

[-- Attachment #2: dup3.c --]
[-- Type: text/plain, Size: 423 bytes --]

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

  reply	other threads:[~2012-10-09  9:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-09  9:15 Another bug, in dup3 Richard W.M. Jones
2012-10-09  9:25 ` Richard W.M. Jones [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121009092549.GA19680@rhmail.home.annexia.org \
    --to=rjones@redhat.com \
    --cc=jim@meyering.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@ZenIV.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).