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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]