mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
qemu: sanity check vhost user FD before passing to QEMU
Ensure that the FD we're passing to QEMU is actually open, so we get a sane error message upfront instead of telling QEMU to use a closed FD. Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
227925a2e5
commit
6ffb8fff9e
@ -4704,6 +4704,12 @@ qemuBuildVhostUserChardevStr(const char *alias,
|
||||
{
|
||||
char *chardev = NULL;
|
||||
|
||||
if (*fd == -1) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Attempt to pass closed vhostuser FD"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (virAsprintf(&chardev, "socket,id=chr-vu-%s,fd=%d", alias, *fd) < 0)
|
||||
return NULL;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user