]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: Let virCommand module translate exitstatus
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 13 Feb 2023 11:35:28 +0000 (12:35 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 3 Mar 2023 11:03:25 +0000 (12:03 +0100)
commitcf01bbb9926a3289e75d8c59dac24d091f85ab06
tree471c6474b505795d778bf7dd9274efdfb0a9a39b
parentcaa25f75cfb1f37a504eadb35d6d9efea43aeff7
qemu: Let virCommand module translate exitstatus

When starting (some) external helpers, callers of
qemuSecurityCommandRun() pass &exitstatus variable, to learn the
exit code of helper process (with qemuTPMEmulatorStart() being
the only exception). Then, if the status wasn't zero they produce
a generic error message, like:

  "Starting of helper process failed. exitstatus=%d"

or, in case of qemuPasstStart():

  "Could not start 'passt': %s"

This is needless as virCommandRun() (that's called under the
hood), can do both for us, if NULL was passed instead of
@exitstatus. Not only it appends exit status, it also reads
stderr of failed command producing comprehensive error message:

  Child process (${args}) unexpected exit status ${exitstatus}: ${stderr}

Therefore, pass NULL everywhere. But in contrast with one of
previous commits which removed @cmdret argument, there could be a
sensible caller which might want to process exit code. So keep
the argument for now and just pass NULL.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_dbus.c
src/qemu/qemu_passt.c
src/qemu/qemu_security.c
src/qemu/qemu_slirp.c
src/qemu/qemu_vhost_user_gpu.c