It does reject the argument if the upper bound is reached. On the lower end, the linux man page does not specify that negative numbers are not allowed as arguments. Note, that fcntl is not supposed to be the same as dup2(), i.e., it does NOT duplicate the given fd into the new one specified, but should return the next available fd equal to or larger than the argument.
Cygwin does this correctly, from what I have tested.


Eric Blake wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

fcntl is supposed to reject attempts to duplicate to an out-of-range fd.
On Linux, this correctly fails with EINVAL.

#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include <stdio.h>
int main()
{
  int i = fcntl (0, F_DUPFD, -1);
  printf ("%d %d %s\n", i, errno, strerror (errno));
  return 0;
}

- --
Don't work too hard, make some time for fun as well!

Eric Blake             e...@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkqPCUQACgkQ84KuGfSFAYAdegCeLzWjDGyi8tVPNoRnt+BIPQF5
lq4AoNHrJnkOp9CnQSUrtHzxXTA1YVrM
=3f49
-----END PGP SIGNATURE-----

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple




--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply via email to