提交 3153ac08 编写于 作者: C Cole Robinson

qemu: command: escape commas in secret master path

Need to convert the local function to virBuffer usage, so we
can use qemuBufferEscapeComma
上级 0f377eb1
...@@ -196,6 +196,7 @@ qemuBuildMasterKeyCommandLine(virCommandPtr cmd, ...@@ -196,6 +196,7 @@ qemuBuildMasterKeyCommandLine(virCommandPtr cmd,
int ret = -1; int ret = -1;
char *alias = NULL; char *alias = NULL;
char *path = NULL; char *path = NULL;
virBuffer buf = VIR_BUFFER_INITIALIZER;
/* If the -object secret does not exist, then just return. This just /* If the -object secret does not exist, then just return. This just
* means the domain won't be able to use a secret master key and is * means the domain won't be able to use a secret master key and is
...@@ -218,12 +219,14 @@ qemuBuildMasterKeyCommandLine(virCommandPtr cmd, ...@@ -218,12 +219,14 @@ qemuBuildMasterKeyCommandLine(virCommandPtr cmd,
goto cleanup; goto cleanup;
virCommandAddArg(cmd, "-object"); virCommandAddArg(cmd, "-object");
virCommandAddArgFormat(cmd, "secret,id=%s,format=raw,file=%s", virBufferAsprintf(&buf, "secret,id=%s,format=raw,file=", alias);
alias, path); qemuBufferEscapeComma(&buf, path);
virCommandAddArgBuffer(cmd, &buf);
ret = 0; ret = 0;
cleanup: cleanup:
virBufferFreeAndReset(&buf);
VIR_FREE(alias); VIR_FREE(alias);
VIR_FREE(path); VIR_FREE(path);
return ret; return ret;
......
...@@ -7,7 +7,7 @@ QEMU_AUDIO_DRV=none \ ...@@ -7,7 +7,7 @@ QEMU_AUDIO_DRV=none \
/usr/bin/qemu \ /usr/bin/qemu \
-name foo,,bar,debug-threads=on \ -name foo,,bar,debug-threads=on \
-S \ -S \
-object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-foo,\ -object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-foo,,\
bar/master-key.aes \ bar/master-key.aes \
-M pc \ -M pc \
-m 214 \ -m 214 \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册