/* Written by Paul Eggert <eggert@twinsun.com>
and Florian Krohm <florian@edamail.fishkill.ibm.com>. */
-#if HAVE_CONFIG_H
+#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifndef __attribute__
/* This feature is available in gcc versions 2.5 and later. */
-# if !defined (__GNUC__) || __GNUC__ < 2 || \
+# if ! defined __GNUC__ || __GNUC__ < 2 || \
(__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
# define __attribute__(Spec) /* empty */
# endif
int child_fd[2];
pid_t pid;
- if (pipe (child_fd) != 0
- || (child_fd[0] = fd_safer (child_fd[0])) < 0
- || (fd[0] = fd_safer (child_fd[1])) < 0
- || pipe (pipe_fd) != 0
- || (fd[1] = fd_safer (pipe_fd[0])) < 0
- || (child_fd[1] = fd_safer (pipe_fd[1])) < 0)
- error (EXIT_FAILURE, errno,
- "pipe");
+ if (pipe_safer (child_fd) != 0 || pipe_safer (pipe_fd) != 0)
+ error (EXIT_FAILURE, errno, "pipe");
+ fd[0] = child_fd[1];
+ fd[1] = pipe_fd[0];
+ child_fd[1] = pipe_fd[1];
pid = vfork ();
if (pid < 0)
- error (EXIT_FAILURE, errno,
- "fork");
+ error (EXIT_FAILURE, errno, "fork");
if (! pid)
{
#if HAVE_WAITPID || defined waitpid
int wstatus;
if (waitpid (pid, &wstatus, 0) < 0)
- error (EXIT_FAILURE, errno,
- "waitpid");
+ error (EXIT_FAILURE, errno, "waitpid");
else
{
int status = WIFEXITED (wstatus) ? WEXITSTATUS (wstatus) : -1;