]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu_tpm: Check for qemuTPMSetupEncryption() errors
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 22 Nov 2022 11:18:35 +0000 (12:18 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 29 Nov 2022 14:22:39 +0000 (15:22 +0100)
commitbc9d0df4f983285c2f26cbbbc5eb6facaedf47fe
treefd9e3922a7d7e2d687391c88cd6dc7bba0eb0cdf
parenta421aa76b1b74d6b307b273f902bd929989ab6e5
qemu_tpm: Check for qemuTPMSetupEncryption() errors

Inside of qemuTPMEmulatorBuildCommand() there are two calls to
qemuTPMSetupEncryption() which simply ignore returned error. This
is suboptimal because then we rely on swtpm binary reporting a
generic error (something among invalid command line arguments)
while an error reported by qemuTPMSetupEncryption() is more
specific.

However, since virCommandSetSendBuffer() only sets an error
inside of virCommand structure (the error is then reported in
virCommandRun()), we need to exempt its retval from error
checking. Thus, the signature of qemuTPMSetupEncryption() is
changed a bit so that -1/0 can be returned to indicate error.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
src/qemu/qemu_tpm.c