Some lines in this file seems a bit strange.
Line 755:

 if (arr2envblk(envp, &envblk, &envsize_needed) == FALSE) {
            pproc->last_err = 0;  << !!
            pproc->lerrno = E_NO_MEM;
            free( command_line );
            if (pproc->last_err == ERROR_INVALID_PARAMETER
               && envsize_needed > 32*1024) {

With the above, the 'if (pproc->last_err ..' test will never
be hit. So the "pproc->last_err = 0" should be put after
the warning. Patch attached.

PS. The test on ERROR_MORE_DATA is important too IMHO.

--
--gv
--- a/w32/subproc/sub_proc.c 2015-09-23 14:26:38
+++ b/w32/subproc/sub_proc.c 2015-09-23 14:36:51
@@ -753,14 +753,14 @@

         if (envp) {
                 if (arr2envblk(envp, &envblk, &envsize_needed) == FALSE) {
-                        pproc->last_err = 0;
                         pproc->lerrno = E_NO_MEM;
                         free( command_line );
-                        if (pproc->last_err == ERROR_INVALID_PARAMETER
+                        if ((pproc->last_err == ERROR_INVALID_PARAMETER || 
pproc->last_err == ERROR_MORE_DATA)
                             && envsize_needed > 32*1024) {
                                 fprintf (stderr, "CreateProcess failed, 
probably because environment is too large (%d bytes).\n",
                                          envsize_needed);
                         }
+                        pproc->last_err = 0;
                         return(-1);
                 }
         }
_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to