mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-04-01 20:05:19 +00:00
qemuDomainGetGuestInfo: don't assign NULL hostname
Don't rely on error check and assign hostname only when non-NULL. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
4a39b25c81
commit
530ac28861
@ -22967,14 +22967,14 @@ qemuDomainGetGuestInfo(virDomainPtr dom,
|
||||
}
|
||||
if (supportedTypes & VIR_DOMAIN_GUEST_INFO_HOSTNAME) {
|
||||
rc = qemuAgentGetHostname(agent, &hostname);
|
||||
if (rc < 0 && !(rc == -2 && types == 0)) {
|
||||
if (rc < 0 && !(rc == -2 && types == 0))
|
||||
goto exitagent;
|
||||
} else {
|
||||
if (virTypedParamsAddString(params, nparams, &maxparams, "hostname",
|
||||
hostname) < 0)
|
||||
goto exitagent;
|
||||
}
|
||||
}
|
||||
|
||||
if (hostname &&
|
||||
virTypedParamsAddString(params, nparams, &maxparams, "hostname", hostname) < 0)
|
||||
goto exitagent;
|
||||
|
||||
if (supportedTypes & VIR_DOMAIN_GUEST_INFO_FILESYSTEM) {
|
||||
rc = qemuAgentGetFSInfo(agent, &agentfsinfo);
|
||||
if (rc < 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user