X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-dup2.c;h=37454e965cab9f8c5cc041d21ee8761d3467415c;hb=d6e564567eb4ab3033d8e08c8467e3d1a3f51c0d;hp=cef9a304d60ac21e9c45a4ac9dcfffa17bb79346;hpb=e016983c7406fb8aa0c750053425ffb3cbaeec4a;p=gnulib.git diff --git a/tests/test-dup2.c b/tests/test-dup2.c index cef9a304d..37454e965 100644 --- a/tests/test-dup2.c +++ b/tests/test-dup2.c @@ -1,5 +1,5 @@ /* Test duplicating file descriptors. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -121,6 +121,9 @@ main (void) ASSERT (dup2 (-1, fd) == -1); ASSERT (errno == EBADF); errno = 0; + ASSERT (dup2 (99, fd) == -1); + ASSERT (errno == EBADF); + errno = 0; ASSERT (dup2 (AT_FDCWD, fd) == -1); ASSERT (errno == EBADF); ASSERT (is_open (fd)); @@ -169,7 +172,12 @@ main (void) ASSERT (dup2 (fd + 1, fd + 1) == fd + 1); ASSERT (!is_inheritable (fd + 1)); ASSERT (dup2 (fd + 1, fd + 2) == fd + 2); + ASSERT (!is_inheritable (fd + 1)); ASSERT (is_inheritable (fd + 2)); + errno = 0; + ASSERT (dup2 (fd + 1, -1) == -1); + ASSERT (errno == EBADF); + ASSERT (!is_inheritable (fd + 1)); #endif /* On systems that distinguish between text and binary mode, dup2