Fix cmdline parameter escape
This commit is contained in:
parent
40ed19767a
commit
7896c30508
@ -631,9 +631,16 @@ ARDOUR::get_jack_default_server_path (std::string& server_path)
|
||||
return true;
|
||||
}
|
||||
|
||||
string
|
||||
quote_string (const string& str)
|
||||
static string
|
||||
quote_string (string str)
|
||||
{
|
||||
/* escape quotes in string */
|
||||
size_t pos = 0;
|
||||
while ((pos = str.find("\"", pos)) != std::string::npos) {
|
||||
str.replace (pos, 1, "\\\"");
|
||||
pos += 2;
|
||||
}
|
||||
/* and quote the whole string */
|
||||
return "\"" + str + "\"";
|
||||
}
|
||||
|
||||
|
@ -215,8 +215,11 @@ SystemExec::SystemExec (std::string command, const std::map<char, std::string> s
|
||||
// ...but always quote all args
|
||||
for (int i = 1; argp[i]; ++i) {
|
||||
std::string tmp (argp[i]);
|
||||
while (tmp.find("\"") != std::string::npos)
|
||||
tmp.replace(tmp.find("\""), 1, "\\\"");
|
||||
size_t start_pos = 0;
|
||||
while ((start_pos = tmp.find("\"", start_pos)) != std::string::npos) {
|
||||
tmp.replace (start_pos, 1, "\\\"");
|
||||
start_pos += 2;
|
||||
}
|
||||
wa += " \"";
|
||||
wa += tmp;
|
||||
wa += '"';
|
||||
|
Loading…
Reference in New Issue
Block a user