Module: wine Branch: oldstable Commit: 93980eeab58d281f6da6e629e807b477f3713c88 URL: https://source.winehq.org/git/wine.git/?a=commit;h=93980eeab58d281f6da6e629e...
Author: Aaron Hill aa1ronham@gmail.com Date: Mon Oct 12 17:36:05 2020 -0400
cmd: Set errorlevel to 0 when 'call' is invoked with an empty string.
Previously, invoking 'call' with an empty string would leave errorlevel unchanged. Reset errorlevel to 0 to match the behavior of the Windows 'cmd.exe'.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49982 Signed-off-by: Aaron Hill aa1ronham@gmail.com Signed-off-by: Alexandre Julliard julliard@winehq.org (cherry picked from commit 8e54cad6a15b3901a748fa228d1a7e456911b9ca) Signed-off-by: Michael Stefaniuc mstefani@winehq.org
---
programs/cmd/tests/test_builtins.cmd | 3 +++ programs/cmd/wcmdmain.c | 5 +++++ 2 files changed, 8 insertions(+)
diff --git a/programs/cmd/tests/test_builtins.cmd b/programs/cmd/tests/test_builtins.cmd index 4bf37a35bb8..8e3cde8b114 100644 --- a/programs/cmd/tests/test_builtins.cmd +++ b/programs/cmd/tests/test_builtins.cmd @@ -3142,6 +3142,9 @@ echo %ErrorLevel% should be 7 if errorlevel 7 echo setting var worked too well, bad call :setError 3 echo %ErrorLevel% should still be 7 +rem Verify that (call ) sets errorlevel to 0 +(call ) +if errorlevel 1 echo errorlevel should have been 0
echo ------------ Testing GOTO ------------ if a==a goto dest1 diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c index 609c6f8bd25..bf3a627d35b 100644 --- a/programs/cmd/wcmdmain.c +++ b/programs/cmd/wcmdmain.c @@ -1055,6 +1055,11 @@ void WCMD_run_program (WCHAR *command, BOOL called) firstParam = WCMD_parameter(command, 0, NULL, FALSE, TRUE); if (!firstParam) return;
+ if (!firstParam[0]) { + errorlevel = 0; + return; + } + /* Calculate the search path and stem to search for */ if (wcspbrk (firstParam, delims) == NULL) { /* No explicit path given, search path */ static const WCHAR curDir[] = {'.',';','\0'};