bug-gnulib
[Top][All Lists]
Advanced

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

Another test-dup3 assertion with the new kernel


From: Richard W.M. Jones
Subject: Another test-dup3 assertion with the new kernel
Date: Wed, 10 Oct 2012 14:23:07 +0100
User-agent: Mutt/1.5.20 (2009-12-10)

Fixing the other two kernel bugs, leaves me with two further
assertions.  This time I'm not so sure that this is a kernel bug.

      /* The destination must be valid.  */
      errno = 0;
      ASSERT (dup3 (fd, -2, o_flags) == -1);
      ASSERT (errno == EBADF);                  <--- here
      errno = 0;
      ASSERT (dup3 (fd, 10000000, o_flags) == -1);
      ASSERT (errno == EBADF);                  <--- and here

In fact the new implementation of dup3 returns EMFILE (Too many open
files) because of the following test:

      if (newfd >= rlimit(RLIMIT_NOFILE))
              return -EMFILE;

combined with the fact that newfd is declared inside the kernel as an
unsigned int (both fd params have been declared as unsigned int at
least as far back as 2008 when the dup3 call was first added).

The change from EBADF to EMFILE seems to be intentional (kernel commit
4e1e018ecc6f7bfd10fc75b3ff9715cc8164e0a2).

I have no opinion on whether the kernel or gnulib is wrong here.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora



reply via email to

[Prev in Thread] Current Thread [Next in Thread]