提交 3000e703 编写于 作者: E Enrico Giordani

[Fix] Sentinel notification-script 2nd argument needs quotes.

上级 20e05d83
......@@ -756,20 +756,31 @@ void sentinelRunPendingScripts(void) {
sj->retry_num++;
#ifdef _WIN32
PROCESS_INFORMATION pi;
/* The notification script is called passing two arguments:
* - the first argument doesn't contain spaces
* - the second argument contains spaces therefore we quote it */
char args[1024];
int j = 0;
int pos = 0;
while (sj->argv[j]) {
if (j == 2) {
memcpy(args + pos, "\"", 1);
pos += 1;
}
int arglen = (int) strlen(sj->argv[j]);
memcpy(args + pos, sj->argv[j], arglen);
pos += arglen;
memcpy(args + pos, " ", 1);
pos += 1;
j++;
if (j == 2) {
memcpy(args + pos, "\"\0", 2);
break;
} else {
memcpy(args + pos, " ", 1);
pos += 1;
j++;
}
}
args[pos - 1] = NULL;
PROCESS_INFORMATION pi;
STARTUPINFO si;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册