[libvirt] [PATCH] virsystemd: Fix error check

Marc Hartmayer mhartmay at linux.vnet.ibm.com
Fri Aug 5 16:04:27 UTC 2016

Commit b3e4401dc620 introduced a check to ignore an error if the guest
is already terminated. However the check accidentally compared
error.code with VIR_ERR_ERROR, which is an error level, not an error
code. Because of this, almost every error got silently ignored.

Fixes: b3e4401dc620 ("systemd: don't report an error if the guest is
already terminated")

Signed-off-by: Marc Hartmayer <mhartmay at linux.vnet.ibm.com>
Reviewed-by: Sascha Silbe <silbe at linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy at linux.vnet.ibm.com>
 src/util/virsystemd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
index 7d6985b..604dcdd 100644
--- a/src/util/virsystemd.c
+++ b/src/util/virsystemd.c
@@ -468,7 +468,7 @@ int virSystemdTerminateMachine(const char *name)
                           name) < 0)
         goto cleanup;
-    if (error.code == VIR_ERR_ERROR &&
+    if (error.level == VIR_ERR_ERROR &&
                         error.str1)) {

More information about the libvir-list mailing list