Revert "poll-win32"
[gnulib.git] / lib / execute.c
index 30ce000..751dcb3 100644 (file)
@@ -1,5 +1,5 @@
 /* Creation of autonomous subprocesses.
-   Copyright (C) 2001-2004, 2006-2007 Free Software Foundation, Inc.
+   Copyright (C) 2001-2004, 2006-2008 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
 
 #endif
 
-#if ! HAVE_ENVIRON_DECL
-extern char **environ;
-#endif
-
 #ifndef STDIN_FILENO
 # define STDIN_FILENO 0
 #endif
@@ -121,7 +117,8 @@ execute (const char *progname,
         const char *prog_path, char **prog_argv,
         bool ignore_sigpipe,
         bool null_stdin, bool null_stdout, bool null_stderr,
-        bool slave_process, bool exit_on_error)
+        bool slave_process, bool exit_on_error,
+        int *termsigp)
 {
 #if defined _MSC_VER || defined __MINGW32__
 
@@ -177,6 +174,9 @@ execute (const char *progname,
   if (null_stdin)
     dup2 (orig_stdin, STDIN_FILENO), close (orig_stdin);
 
+  if (termsigp != NULL)
+    *termsigp = 0;
+
   if (exitcode == -1)
     {
       if (exit_on_error || !null_stderr)
@@ -255,6 +255,8 @@ execute (const char *progname,
        posix_spawnattr_destroy (&attrs);
       if (slave_process)
        unblock_fatal_signals ();
+      if (termsigp != NULL)
+       *termsigp = 0;
       if (exit_on_error || !null_stderr)
        error (exit_on_error ? EXIT_FAILURE : 0, err,
               _("%s subprocess failed"), progname);
@@ -297,6 +299,8 @@ execute (const char *progname,
     {
       if (slave_process)
        unblock_fatal_signals ();
+      if (termsigp != NULL)
+       *termsigp = 0;
       if (exit_on_error || !null_stderr)
        error (exit_on_error ? EXIT_FAILURE : 0, errno,
               _("%s subprocess failed"), progname);
@@ -310,7 +314,7 @@ execute (const char *progname,
     }
 
   return wait_subprocess (child, progname, ignore_sigpipe, null_stderr,
-                         slave_process, exit_on_error);
+                         slave_process, exit_on_error, termsigp);
 
 #endif
 }