---
src/qemu/qemu_monitor.c | 6 +++---
src/qemu/qemu_monitor.h | 3 ++-
src/qemu/qemu_process.c | 6 ++++++
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index fcdd41d..d251ae1 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -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;
}
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index d673154..999af10 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -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);
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index d9611c9..276837e 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -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)) {
--
2.3.5