diff options
author | Eric Blake <eblake@redhat.com> | 2011-03-31 15:28:37 -0600 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2011-03-31 15:28:37 -0600 |
commit | dec3475763be252103922a887920012eeb32dc26 (patch) | |
tree | bc49e17cf6df9fc929203bcbc7d0f23791442a4d /tests | |
parent | f31ee76bd843ff9c940b51e14b9e49cfe774aed5 (diff) | |
download | gnulib-dec3475763be252103922a887920012eeb32dc26.tar.gz |
nonblocking: fix mingw test failures
Actually testing on mingw uncovered a few more problems.
* lib/nonblocking.c (set_nonblocking_flag): Succeed when clearing
non-blocking flag on regular file.
(get_nonblocking_flag): Set errno on invalid fd.
* tests/test-nonblocking.c (main): Avoid test failure on
directories if fchdir is not active.
* modules/nonblocking-tests (Depends-on): Drop unused dependency.
Signed-off-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-nonblocking.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/test-nonblocking.c b/tests/test-nonblocking.c index 0762cd0ae1..f1b7610543 100644 --- a/tests/test-nonblocking.c +++ b/tests/test-nonblocking.c @@ -55,11 +55,14 @@ main (void) /* Test directories; setting nonblocking is unspecified. */ fd_file = open (".", O_RDONLY); - ASSERT (STDERR_FILENO < fd_file); - ASSERT (get_nonblocking_flag (fd_file) == 0); - ASSERT (set_nonblocking_flag (fd_file, false) == 0); - ASSERT (get_nonblocking_flag (fd_file) == 0); - ASSERT (close (fd_file) == 0); + if (STDERR_FILENO < fd_file) + { + /* mingw can't open directories unless fchdir module is active. */ + ASSERT (get_nonblocking_flag (fd_file) == 0); + ASSERT (set_nonblocking_flag (fd_file, false) == 0); + ASSERT (get_nonblocking_flag (fd_file) == 0); + ASSERT (close (fd_file) == 0); + } /* Test pipes. */ ASSERT (pipe (fd_pipe) == 0); |