diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c index ec66cd57243..04b098e98db 100644 --- a/programs/cmd/builtins.c +++ b/programs/cmd/builtins.c @@ -4322,7 +4322,7 @@ void WCMD_start(WCHAR *args) int argno; int have_title; WCHAR file[MAX_PATH]; - WCHAR *cmdline; + WCHAR *cmdline, *cmdline_params; STARTUPINFOW st; PROCESS_INFORMATION pi; @@ -4331,6 +4331,7 @@ void WCMD_start(WCHAR *args) cmdline = heap_alloc( (strlenW(file) + strlenW(args) + 8) * sizeof(WCHAR) ); strcpyW( cmdline, file ); strcatW( cmdline, spaceW ); + cmdline_params = cmdline + strlenW(cmdline); /* The start built-in has some special command-line parsing properties * which will be outlined here. @@ -4382,17 +4383,17 @@ void WCMD_start(WCHAR *args) have_title = TRUE; /* Copy all of the cmdline processed */ - memcpy(cmdline, args, sizeof(WCHAR) * (argN - args)); - cmdline[argN - args] = '\0'; + memcpy(cmdline_params, args, sizeof(WCHAR) * (argN - args)); + cmdline_params[argN - args] = '\0'; /* Add quoted title */ - strcatW(cmdline, prefixQuote); - strcatW(cmdline, thisArg); - strcatW(cmdline, postfixQuote); + strcatW(cmdline_params, prefixQuote); + strcatW(cmdline_params, thisArg); + strcatW(cmdline_params, postfixQuote); /* Concatenate remaining command-line */ thisArg = WCMD_parameter_with_delims(args, argno, &argN, TRUE, FALSE, startDelims); - strcatW(cmdline, argN + strlenW(thisArg)); + strcatW(cmdline_params, argN + strlenW(thisArg)); break; } diff --git a/programs/cmd/tests/test_builtins.cmd b/programs/cmd/tests/test_builtins.cmd index f6846283c72..63ec3cacb1d 100644 --- a/programs/cmd/tests/test_builtins.cmd +++ b/programs/cmd/tests/test_builtins.cmd @@ -2988,6 +2988,10 @@ path set path=%WINE_backup_path% set WINE_backup_path= +echo ------------ Testing start /W ------------ +echo start /W failed to wait>foobar.txt +start /W "" cmd /C "ping -n1 & echo start /W seems to really wait>foobar.txt"& type foobar.txt& del foobar.txt + echo ------------ Testing combined CALLs/GOTOs ------------ echo @echo off>foo.cmd echo goto :eof>>foot.cmd diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp index 4663c862fae..dcc96299b9e 100644 --- a/programs/cmd/tests/test_builtins.cmd.exp +++ b/programs/cmd/tests/test_builtins.cmd.exp @@ -1574,6 +1574,8 @@ Correctly ignored trailing information PATH=original PATH=try2 PATH=try3 +------------ Testing start /W ------------ +start /W seems to really wait ------------ Testing combined CALLs/GOTOs ------------ world cheball