Fix diagnostics on MS-Windows when environment is too large

* w32/subproc/sub_proc.c (process_begin): Fix test of the error
	cause when the environment block is too large.

Copyright-paperwork-exempt: yes.
This commit is contained in:
Gisle Vanem 2015-11-07 11:27:03 +02:00 committed by Eli Zaretskii
parent 83443c706a
commit 168f12375d

View File

@ -753,14 +753,15 @@ process_begin(
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);
}
}