提交 530ac288 编写于 作者: P Peter Krempa

qemuDomainGetGuestInfo: don't assign NULL hostname

Don't rely on error check and assign hostname only when non-NULL.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 4a39b25c
......@@ -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)) {
goto exitagent;
} else {
if (virTypedParamsAddString(params, nparams, &maxparams, "hostname",
hostname) < 0)
if (rc < 0 && !(rc == -2 && types == 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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册