[libvirt] [PATCH 1/3] qemuagenttest: Fix checking of shutdown mode

Peter Krempa pkrempa at redhat.com
Thu Aug 1 14:39:02 UTC 2013


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 reveald a mistake in the expected shutdown mode.

Reported by John Ferlan.
---
 tests/qemuagenttest.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/tests/qemuagenttest.c b/tests/qemuagenttest.c
index 4b6392b..e0df297 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)
-- 
1.8.3.2




More information about the libvir-list mailing list