qemu: command: escape commas in secret master path

Need to convert the local function to virBuffer usage, so we
can use qemuBufferEscapeComma
This commit is contained in:
Cole Robinson 2016-04-22 18:22:05 -04:00
parent 0f377eb1b0
commit 3153ac08c9
2 changed files with 6 additions and 3 deletions

View File

@ -196,6 +196,7 @@ qemuBuildMasterKeyCommandLine(virCommandPtr cmd,
int ret = -1;
char *alias = NULL;
char *path = NULL;
virBuffer buf = VIR_BUFFER_INITIALIZER;
/* 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
@ -218,12 +219,14 @@ qemuBuildMasterKeyCommandLine(virCommandPtr cmd,
goto cleanup;
virCommandAddArg(cmd, "-object");
virCommandAddArgFormat(cmd, "secret,id=%s,format=raw,file=%s",
alias, path);
virBufferAsprintf(&buf, "secret,id=%s,format=raw,file=", alias);
qemuBufferEscapeComma(&buf, path);
virCommandAddArgBuffer(cmd, &buf);
ret = 0;
cleanup:
virBufferFreeAndReset(&buf);
VIR_FREE(alias);
VIR_FREE(path);
return ret;

View File

@ -7,7 +7,7 @@ QEMU_AUDIO_DRV=none \
/usr/bin/qemu \
-name foo,,bar,debug-threads=on \
-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 \
-M pc \
-m 214 \