process: adjust quote_cmd_arg for empty arguments

adjust quote_cmd_arg so that empty command line
arguments are double quoted instead of skipped
This commit is contained in:
Ryan Cole 2014-04-30 19:49:49 -05:00 committed by Saúl Ibarra Corretgé
parent 85e17ca665
commit 907b55e4bf
2 changed files with 4 additions and 4 deletions

View File

@ -430,11 +430,10 @@ WCHAR* quote_cmd_arg(const WCHAR *source, WCHAR *target) {
int quote_hit;
WCHAR* start;
/*
* Check if the string must be quoted;
* if unnecessary, don't do it, it may only confuse older programs.
*/
if (len == 0) {
/* Need double quotation for empty argument */
*(target++) = L'"';
*(target++) = L'"';
return target;
}

View File

@ -808,6 +808,7 @@ WCHAR* quote_cmd_arg(const WCHAR *source, WCHAR *target);
TEST_IMPL(argument_escaping) {
const WCHAR* test_str[] = {
L"",
L"HelloWorld",
L"Hello World",
L"Hello\"World",