From: Bruno Haible Date: Sat, 22 Aug 2009 16:58:09 +0000 (+0200) Subject: Use module pipe2. X-Git-Tag: v0.1~5615 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=c7054c798329aaa675b627e09180b0730eee49f5;p=gnulib.git Use module pipe2. --- diff --git a/ChangeLog b/ChangeLog index 690febdd9..b8aff86cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2009-08-22 Bruno Haible + * lib/pipe.c (create_pipe): Use pipe2 instead of _pipe. + * modules/pipe (Depends-on): Add pipe2. + +2009-08-22 Bruno Haible + Tests for module 'pipe2'. * modules/pipe2-tests: New file. * tests/test-pipe2.c: New file. diff --git a/lib/pipe.c b/lib/pipe.c index daf7f7ffe..d17c9bf6c 100644 --- a/lib/pipe.c +++ b/lib/pipe.c @@ -133,12 +133,12 @@ create_pipe (const char *progname, prog_argv = prepare_spawn (prog_argv); if (pipe_stdout) - if (_pipe (ifd, 4096, O_BINARY | O_NOINHERIT) < 0 + if (pipe2 (ifd, O_BINARY | O_NOINHERIT) < 0 || (ifd[0] = fd_safer_noinherit (ifd[0])) < 0 || (ifd[1] = fd_safer_noinherit (ifd[1])) < 0) error (EXIT_FAILURE, errno, _("cannot create pipe")); if (pipe_stdin) - if (_pipe (ofd, 4096, O_BINARY | O_NOINHERIT) < 0 + if (pipe2 (ofd, O_BINARY | O_NOINHERIT) < 0 || (ofd[0] = fd_safer_noinherit (ofd[0])) < 0 || (ofd[1] = fd_safer_noinherit (ofd[1])) < 0) error (EXIT_FAILURE, errno, _("cannot create pipe")); diff --git a/modules/pipe b/modules/pipe index 570d71d99..bb1ebeea3 100644 --- a/modules/pipe +++ b/modules/pipe @@ -15,6 +15,7 @@ exit fatal-signal gettext-h open +pipe2 spawn posix_spawnp posix_spawn_file_actions_init