summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjorn Munch <Bjorn.Munch@sun.com>2010-01-20 14:20:53 +0100
committerBjorn Munch <Bjorn.Munch@sun.com>2010-01-20 14:20:53 +0100
commita1c940535464869f11287ec193d5d1ce9afcb8b5 (patch)
treec40aee1d0b8a8d380a8dd97877daeb76f45c7fe1
parent94ccc34537d1e9ed75a4941773d84230ec4f7ee2 (diff)
parent9ff20f55bdd78bb69815505f40afaf6b0eb13b21 (diff)
downloadmariadb-git-a1c940535464869f11287ec193d5d1ce9afcb8b5.tar.gz
merge 43005
-rwxr-xr-xmysql-test/lib/My/SafeProcess/safe_process_win.cc22
1 files changed, 14 insertions, 8 deletions
diff --git a/mysql-test/lib/My/SafeProcess/safe_process_win.cc b/mysql-test/lib/My/SafeProcess/safe_process_win.cc
index aa9093fb2b4..896bd599f4f 100755
--- a/mysql-test/lib/My/SafeProcess/safe_process_win.cc
+++ b/mysql-test/lib/My/SafeProcess/safe_process_win.cc
@@ -186,14 +186,20 @@ int main(int argc, const char** argv )
die("No real args -> nothing to do");
/* Copy the remaining args to child_arg */
for (int j= i+1; j < argc; j++) {
- if (strchr (argv[j], ' ')) {
- /* Protect with "" if this arg contains a space */
- to+= _snprintf(to, child_args + sizeof(child_args) - to,
- "\"%s\" ", argv[j]);
- } else {
- to+= _snprintf(to, child_args + sizeof(child_args) - to,
- "%s ", argv[j]);
- }
+ arg= argv[j];
+ if (strchr (arg, ' ') &&
+ arg[0] != '\"' &&
+ arg[strlen(arg)] != '\"')
+ {
+ /* Quote arg that contains spaces and are not quoted already */
+ to+= _snprintf(to, child_args + sizeof(child_args) - to,
+ "\"%s\" ", arg);
+ }
+ else
+ {
+ to+= _snprintf(to, child_args + sizeof(child_args) - to,
+ "%s ", arg);
+ }
}
break;
} else {