]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsystemd: Fix error check
authorMarc Hartmayer <mhartmay@linux.vnet.ibm.com>
Fri, 5 Aug 2016 16:04:27 +0000 (18:04 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 8 Aug 2016 06:15:59 +0000 (08:15 +0200)
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@linux.vnet.ibm.com>
Reviewed-by: Sascha Silbe <silbe@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
src/util/virsystemd.c

index 7d6985b0e353e43894deda31d8f861b5d493c8cc..604dcdd0ad24747a8b443686664006c3f7afd69f 100644 (file)
@@ -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 &&
         STRNEQ_NULLABLE("org.freedesktop.machine1.NoSuchMachine",
                         error.str1)) {
         virReportErrorObject(&error);