Move more declarations into <unistd.h>.
[gnulib.git] / lib / execute.c
index add7163..ca0c89c 100644 (file)
@@ -1,5 +1,5 @@
 /* Creation of autonomous subprocesses.
-   Copyright (C) 2001-2004, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2001-2004, 2006-2007 Free Software Foundation, Inc.
    Written by Bruno Haible <haible@clisp.cons.org>, 2001.
 
    This program is free software; you can redistribute it and/or modify
@@ -17,9 +17,7 @@
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
 
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
+#include <config.h>
 
 /* Specification.  */
 #include "execute.h"
@@ -32,7 +30,6 @@
 #include <unistd.h>
 
 #include "error.h"
-#include "exit.h"
 #include "fatal-signal.h"
 #include "wait-process.h"
 #include "gettext.h"
 #else
 
 /* Unix API.  */
-# ifdef HAVE_POSIX_SPAWN
+# if HAVE_POSIX_SPAWN
 #  include <spawn.h>
 # else
-#  ifdef HAVE_VFORK_H
+#  if HAVE_VFORK_H
 #   include <vfork.h>
 #  endif
 # endif
 
 #endif
 
-#ifndef HAVE_ENVIRON_DECL
+#if ! HAVE_ENVIRON_DECL
 extern char **environ;
 #endif
 
@@ -72,6 +69,11 @@ extern char **environ;
 # define STDERR_FILENO 2
 #endif
 
+/* The results of open() in this file are not used with fchdir,
+   therefore save some unnecessary work in fchdir.c.  */
+#undef open
+#undef close
+
 
 #ifdef EINTR
 
@@ -308,7 +310,7 @@ execute (const char *progname,
       unblock_fatal_signals ();
     }
 
-  return wait_subprocess (child, progname, NULL, ignore_sigpipe, null_stderr,
+  return wait_subprocess (child, progname, ignore_sigpipe, null_stderr,
                          slave_process, exit_on_error);
 
 #endif