Fix build failures on EMX for output-sync support.
authorPaul Smith <psmith@gnu.org>
Sun, 29 Sep 2013 17:17:56 +0000 (13:17 -0400)
committerPaul Smith <psmith@gnu.org>
Sun, 29 Sep 2013 17:17:56 +0000 (13:17 -0400)
ChangeLog
function.c
job.c
job.h
w32/compat/posixfcn.c

index 14ea56d99a74a7bf5517bf955aede916b3d2e684..0831076d31be52fbc42e4b78b6e4e8adc251b38b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2013-09-29  Paul Smith  <psmith@gnu.org>
 
+       * function.c (func_shell_base) [EMX]: Fix EMX support for output-sync.
+       * job.c (child_execute_job) [EMX]: Ditto.
+       * job.h (child_execute_job) [EMX]: Ditto.
+       * w32/compat/posixfcn.c: Invert the test for NO_OUTPUT_SYNC.
+
        * guile.c (GSUBR_TYPE): Pre-2.0 Guile doesn't provide a typedef
        for gsubr pointers.  Create one.
        (guile_define_module): Use it.
index 866ac48b1b4560cd47261f07199015d5c86f979f..b8b9cf3900462681ba706c6debea26cf3f706475 100644 (file)
@@ -1652,15 +1652,15 @@ func_shell_base (char *o, char **argv, int trim_newlines)
 #endif
 
   /* Using a target environment for 'shell' loses in cases like:
-     export var = $(shell echo foobie)
-     because target_environment hits a loop trying to expand $(var)
-     to put it in the environment.  This is even more confusing when
-     var was not explicitly exported, but just appeared in the
-     calling environment.
+       export var = $(shell echo foobie)
+       bad := $(var)
+     because target_environment hits a loop trying to expand $(var) to put it
+     in the environment.  This is even more confusing when var was not
+     explicitly exported, but just appeared in the calling environment.
 
      See Savannah bug #10593.
 
-  envp = target_environment (NILF);
+  envp = target_environment (NULL);
   */
 
   envp = environ;
@@ -1710,7 +1710,7 @@ func_shell_base (char *o, char **argv, int trim_newlines)
   CLOSE_ON_EXEC(pipedes[1]);
   CLOSE_ON_EXEC(pipedes[0]);
   /* Never use fork()/exec() here! Use spawn() instead in exec_command() */
-  pid = child_execute_job (FD_STDIN, pipedes[1], FD_STDOUT, command_argv, envp);
+  pid = child_execute_job (FD_STDIN, pipedes[1], FD_STDERR, command_argv, envp);
   if (pid < 0)
     perror_with_name (error_prefix, "spawn");
 # else /* ! __EMX__ */
diff --git a/job.c b/job.c
index 12b0ff656826a1fa040540f772c9b48e84b2461f..febfac0cd5f19c471668ca6a87fba99f3c1f5adc 100644 (file)
--- a/job.c
+++ b/job.c
@@ -2234,7 +2234,7 @@ child_execute_job (int stdin_fd, int stdout_fd, int stderr_fd,
   /* Restore stdout/stdin/stderr of the parent and close temporary FDs.  */
   if (save_stdin >= 0)
     {
-      if (dup2 (save_stdin, FD_STDIN) != 0)
+      if (dup2 (save_stdin, FD_STDIN) != FD_STDIN)
         fatal (NILF, _("Could not restore stdin\n"));
       else
         close (save_stdin);
@@ -2242,7 +2242,7 @@ child_execute_job (int stdin_fd, int stdout_fd, int stderr_fd,
 
   if (save_stdout >= 0)
     {
-      if (dup2 (save_stdout, FD_STDOUT) != 0)
+      if (dup2 (save_stdout, FD_STDOUT) != FD_STDOUT)
         fatal (NILF, _("Could not restore stdout\n"));
       else
         close (save_stdout);
@@ -2250,7 +2250,7 @@ child_execute_job (int stdin_fd, int stdout_fd, int stderr_fd,
 
   if (save_stderr >= 0)
     {
-      if (dup2 (save_stderr, FD_STDERR) != 0)
+      if (dup2 (save_stderr, FD_STDERR) != FD_STDERR)
         fatal (NILF, _("Could not restore stderr\n"));
       else
         close (save_stderr);
diff --git a/job.h b/job.h
index c97f7c0d6292f66be5d239497d70991cb1793305..8a2017789f3a8d0b046adf55bf3b9a618c9515fd 100644 (file)
--- a/job.h
+++ b/job.h
@@ -128,7 +128,7 @@ int child_execute_job (char *argv, struct child *child);
 # define FD_STDERR      (fileno (stderr))
 # if defined(__EMX__)
 int child_execute_job (int stdin_fd, int stdout_fd, int stderr_fd,
-                       char **argv, char **envp)
+                       char **argv, char **envp);
 # else
 void child_execute_job (int stdin_fd, int stdout_fd, int stderr_fd,
                         char **argv, char **envp) __attribute__ ((noreturn));
index 627fc506e4c66864e9ea2983d91ce08bcf53146f..cde81ce04dc1365d47e0c9643b4d265e8a5d1f94 100644 (file)
@@ -26,7 +26,7 @@ this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "makeint.h"
 #include "job.h"
 
-#ifdef NO_OUTPUT_SYNC
+#ifndef NO_OUTPUT_SYNC
 /* Support for OUTPUT_SYNC and related functionality.  */
 
 /* Emulation of fcntl that supports only F_GETFD and F_SETLKW.  */