Commit a1c94053 authored by Bjorn Munch's avatar Bjorn Munch

merge 43005

parents 94ccc345 9ff20f55
...@@ -186,13 +186,19 @@ int main(int argc, const char** argv ) ...@@ -186,13 +186,19 @@ int main(int argc, const char** argv )
die("No real args -> nothing to do"); die("No real args -> nothing to do");
/* Copy the remaining args to child_arg */ /* Copy the remaining args to child_arg */
for (int j= i+1; j < argc; j++) { for (int j= i+1; j < argc; j++) {
if (strchr (argv[j], ' ')) { arg= argv[j];
/* Protect with "" if this arg contains a space */ 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, to+= _snprintf(to, child_args + sizeof(child_args) - to,
"\"%s\" ", argv[j]); "\"%s\" ", arg);
} else { }
else
{
to+= _snprintf(to, child_args + sizeof(child_args) - to, to+= _snprintf(to, child_args + sizeof(child_args) - to,
"%s ", argv[j]); "%s ", arg);
} }
} }
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment