From: Peter Krempa Date: Thu, 1 Aug 2013 14:19:09 +0000 (+0200) Subject: qemuagenttest: Fix checking of shutdown mode X-Git-Tag: CVE-2013-4239~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=baebb34120f56c9ed9c11be2d8710e9bd8544ea8;p=thirdparty%2Flibvirt.git qemuagenttest: Fix checking of shutdown mode Coverity complained about unused variable that contains the shutdown mode. The original intention was to check it against the requested mode. Also the fixed check revealed a mistake in the expected shutdown mode. Reported by John Ferlan. --- diff --git a/tests/qemuagenttest.c b/tests/qemuagenttest.c index cabd5b7ca0..91ea4e11f3 100644 --- a/tests/qemuagenttest.c +++ b/tests/qemuagenttest.c @@ -251,6 +251,13 @@ qemuAgentShutdownTestMonitorHandler(qemuMonitorTestPtr test, goto cleanup; } + if (STRNEQ(mode, data->mode)) { + ret = qemuMonitorReportError(test, + "expected shutdown mode '%s' got '%s'", + data->mode, mode); + goto cleanup; + } + /* now don't reply but return a qemu agent event */ qemuAgentNotifyEvent(qemuMonitorTestGetAgent(test), data->event); @@ -279,7 +286,7 @@ testQemuAgentShutdown(const void *data) goto cleanup; priv.event = QEMU_AGENT_EVENT_SHUTDOWN; - priv.mode = "shutdown"; + priv.mode = "halt"; if (qemuMonitorTestAddHandler(test, qemuAgentShutdownTestMonitorHandler, &priv, NULL) < 0)