提交 ee591240 编写于 作者: P Peter Krempa

qemu: monitor: Ensure that qemuMonitorSetLink is called with non-null name

上级 0e9fadd6
......@@ -1672,11 +1672,11 @@ qemuMonitorSetLink(qemuMonitorPtr mon,
virDomainNetInterfaceLinkState state)
{
int ret;
VIR_DEBUG("mon=%p, name=%p:%s, state=%u", mon, name, name, state);
VIR_DEBUG("mon=%p, name=%s, state=%u", mon, name, state);
if (!mon || !name) {
if (!mon) {
virReportError(VIR_ERR_INVALID_ARG, "%s",
_("monitor || name must not be NULL"));
_("monitor must not be NULL"));
return -1;
}
......
......@@ -233,7 +233,8 @@ int qemuMonitorSetCapabilities(qemuMonitorPtr mon);
int qemuMonitorSetLink(qemuMonitorPtr mon,
const char *name,
virDomainNetInterfaceLinkState state);
virDomainNetInterfaceLinkState state)
ATTRIBUTE_NONNULL(2);
/* These APIs are for use by the internal Text/JSON monitor impl code only */
char *qemuMonitorNextCommandID(qemuMonitorPtr mon);
......
......@@ -2355,6 +2355,12 @@ qemuProcessSetLinkStates(virDomainObjPtr vm)
for (i = 0; i < def->nnets; i++) {
if (def->nets[i]->linkstate == VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN) {
if (!def->nets[i]->info.alias) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("missing alias for network device"));
return -1;
}
VIR_DEBUG("Setting link state: %s", def->nets[i]->info.alias);
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册