]> git.ipfire.org Git - thirdparty/make.git/commitdiff
function.c (func_shell) [WINDOWS32]: Reset just_print_flag
authorEli Zaretskii <eliz@gnu.org>
Sat, 7 Aug 2010 08:46:06 +0000 (08:46 +0000)
committerEli Zaretskii <eliz@gnu.org>
Sat, 7 Aug 2010 08:46:06 +0000 (08:46 +0000)
 around the call to construct_command_argv, so that a temporary
 batch file _is_ created when needed for $(shell).  Fixes Savannah
 bug #16362.

ChangeLog
function.c

index 8f7d1c367929aeb34e9457fc28a0535e7fb6fa28..cc96754846a51d89c5983e6d71b733857818c5e2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-08-07  Eli Zaretskii  <eliz@gnu.org>
+
+       * function.c (func_shell) [WINDOWS32]: Reset just_print_flag
+       around the call to construct_command_argv, so that a temporary
+       batch file _is_ created when needed for $(shell).  Fixes Savannah
+       bug #16362.
+
 2010-08-07 Juan Manuel Guerrero  <juan.guerrero@gmx.de>
 
        * configh.dos.template (HAVE_STRNCASECMP): Define.
index e2f6c8c938b763d5a640cd0fd929dd0a1acdaf8b..2bc61fec971af5ccfad1a0c9c3972a1108e5ff8b 100644 (file)
@@ -1597,11 +1597,24 @@ func_shell (char *o, char **argv, const char *funcname UNUSED)
   pid_t pid;
 
 #ifndef __MSDOS__
+#ifdef WINDOWS32
+  /* Reset just_print_flag.  This is needed on Windows when batch files
+     are used to run the commands, because we normally refrain from
+     creating batch files under -n.  */
+  int j_p_f = just_print_flag;
+
+  just_print_flag = 0;
+#endif
   /* Construct the argument list.  */
   command_argv = construct_command_argv (argv[0], NULL, NULL, 0,
                                          &batch_filename);
   if (command_argv == 0)
-    return o;
+    {
+#ifdef WINDOWS32
+      just_print_flag = j_p_f;
+#endif
+      return o;
+    }
 #endif
 
   /* Using a target environment for `shell' loses in cases like:
@@ -1637,11 +1650,13 @@ func_shell (char *o, char **argv, const char *funcname UNUSED)
     }
 #elif defined(WINDOWS32)
   windows32_openpipe (pipedes, &pid, command_argv, envp);
+  /* Restore the value of just_print_flag.  */
+  just_print_flag = j_p_f;
+
   if (pipedes[0] < 0)
     {
-      /* open of the pipe failed, mark as failed execution */
+      /* Open of the pipe failed, mark as failed execution.  */
       shell_function_completed = -1;
-
       return o;
     }
   else