]> git.ipfire.org Git - thirdparty/make.git/commitdiff
[SV 50021] Avoid infloop on MS-Windows with short scripts
authorEli Zaretskii <eliz@gnu.org>
Wed, 11 Jan 2017 18:43:41 +0000 (20:43 +0200)
committerEli Zaretskii <eliz@gnu.org>
Wed, 11 Jan 2017 18:43:41 +0000 (20:43 +0200)
* job.c (reap_children) [WINDOWS32]: Avoid recursive call to
reap_children when the argument passed to
map_windows32_error_to_string is negative or too large.

job.c

diff --git a/job.c b/job.c
index 81248971b640b77a5bc2f713d22879e73335788a..194d2576d9f77984b10edfe9661a6bf7078cc9a6 100644 (file)
--- a/job.c
+++ b/job.c
@@ -774,9 +774,12 @@ reap_children (int block, int err)
                 /* get exit data */
                 exit_code = process_exit_code (hPID);
 
-                if (werr)
-                  fprintf (stderr, "make (e=%d): %s", exit_code,
-                           map_windows32_error_to_string (exit_code));
+               /* the extra tests of exit_code are here to prevent
+                  map_windows32_error_to_string from calling 'fatal',
+                  which will then call reap_children again */
+                if (werr && exit_code > 0 && exit_code < WSABASEERR)
+                 fprintf (stderr, "make (e=%d): %s", exit_code,
+                          map_windows32_error_to_string (exit_code));
 
                 /* signal */
                 exit_sig = process_signal (hPID);