Fix handling of closed stdin/stdout/stderr on mingw.
[pspp] / ChangeLog
index f4ababb9277b9b3a3fc07352558367928bebd72a..44d91e6ea8311a7bb8c8eb27b4be5d63d315a672 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,58 @@
+2009-07-19  Bruno Haible  <bruno@clisp.org>
+
+       Fix handling of closed stdin/stdout/stderr on mingw.
+       * lib/w32spawn.h: Include unistd.h.
+       (dup_noinherit): Return -1 if the old handle is invalid. Allocate new
+       file descriptor with O_NOINHERIT flag.
+       (fd_safer_noinherit): New function, based on fd-safer.c.
+       (dup_safer_noinherit): New function, based on dup-safer.c.
+       (undup_safer_noinherit): New function.
+       * lib/execute.c (execute) [WIN32]: Use dup_safer_noinherit instead of
+       dup_noinherit. Use undup_safer_noinherit instead of dup2 and close.
+       * lib/pipe.c (create_pipe) [WIN32]: Likewise. Use fd_safer_noinherit
+       instead of fd_safer.
+       * tests/test-pipe.c: Include <windows.h>.
+       (child_main) [WIN32]: Test the handle of STDERR_FILENO, not its close() result.
+
+       * tests/test-pipe.c (child_main, parent_main): New functions, extracted
+       from main.
+       (test_pipe): Pass an extra argument for disambiguation.
+       (main): Invoke parent_main or child_main.
+
+       * tests/test-pipe.c (test_pipe): Pass slave_process = true argument
+       consistently.
+
+2009-07-18  Eric Blake  <ebb9@byu.net>
+
+       test-pipe: fix mingw build
+       * tests/test-pipe.c (main): Avoid fcntl on mingw.
+
+2009-07-18  Bruno Haible  <bruno@clisp.org>
+
+       * modules/pipe-tests (Makefile.am): Fix typo.
+
+2009-07-18  Eric Blake  <ebb9@byu.net>
+
+       error: fix mingw build
+       * lib/error.c (error, error_at_line): Avoid fcntl on mingw.
+       Reported by Bruno Haible.
+
+       error: avoid undefined use of stdout
+       * lib/error.c (error, error_at_line): Check that fd 1 is open
+       before flushing stdout.  Avoids a crash on cygwin when libsigsegv
+       is handling faults and the close_stdout module wants to report the
+       detection of closed stdout as an error.
+
+2009-07-17  Eric Blake  <ebb9@byu.net>
+
+       pipe: be robust in face of closed fds
+       * lib/pipe.c (create_pipe): Closed standard descriptors in parent
+       should cause child to misbehave.
+       * modules/pipe-tests: New module.
+       * tests/test-pipe.c: New file.
+       * tests/test-pipe.sh: New file.
+       Reported by Akim Demaille.
+
 2009-07-14  Bruno Haible  <bruno@clisp.org>
 
        * m4/wcwidth.m4 (gl_FUNC_WCWIDTH): Guess it works on glibc systems.