summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2019-03-26 22:12:48 +0100
committerRobin Gareus <robin@gareus.org>2019-03-26 22:12:48 +0100
commit86138d18f9d40d29bf3de0439a5f6be65f69dded (patch)
treeae34a1b795578cf36cb2aba0e06bd896a3d947c6
parent952577b4801b6fc3ec2d33fa5f8bc1a692efab35 (diff)
Remove extra quotes from meta-data
Arguments are passed as argp[] array to execve() and don't need to be enclosed by quotes.
-rw-r--r--libs/pbd/system_exec.cc17
1 files changed, 8 insertions, 9 deletions
diff --git a/libs/pbd/system_exec.cc b/libs/pbd/system_exec.cc
index 29bc11bb3b..0a17cce560 100644
--- a/libs/pbd/system_exec.cc
+++ b/libs/pbd/system_exec.cc
@@ -249,23 +249,22 @@ SystemExec::format_key_value_parameter (std::string key, std::string value)
start_pos += 1;
}
+#ifdef PLATFORM_WINDOWS
+ /* SystemExec::make_wargs() adds quotes around the complete argument
+ * windows uses CreateProcess() with a parameter string
+ * (and not an array list of separate arguments like Unix)
+ * so quotes need to be escaped.
+ */
start_pos = 0;
while((start_pos = v1.find("\"", start_pos)) != std::string::npos) {
v1.replace(start_pos, 1, "\\\"");
start_pos += 2;
}
+#endif
- size_t len = key.length() + v1.length() + 4;
+ size_t len = key.length() + v1.length() + 2;
char *mds = (char*) calloc(len, sizeof(char));
-#ifdef PLATFORM_WINDOWS
- /* SystemExec::make_wargs() adds quotes around the complete argument
- * windows uses CreateProcess() with a parameter string
- * (and not an array list of separate arguments)
- */
snprintf(mds, len, "%s=%s", key.c_str(), v1.c_str());
-#else
- snprintf(mds, len, "%s=\"%s\"", key.c_str(), v1.c_str());
-#endif
return mds;
}