[libvirt] [PATCH] Fix check of virKillProcess return status

Daniel P. Berrange berrange at redhat.com
Sat Jun 4 10:16:11 UTC 2011


The error code for virKillProcess is returned in the errno variable
not the return value. THis mistake caused the logs to be filled with
errors when shutting down QEMU processes

* src/qemu/qemu_process.c: Fix process kill check.
---
 src/qemu/qemu_process.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 116253e..ce05133 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2513,7 +2513,6 @@ cleanup:
 void qemuProcessKill(virDomainObjPtr vm)
 {
     int i;
-    int rc;
     VIR_DEBUG("vm=%s pid=%d", vm->def->name, vm->pid);
 
     if (!virDomainObjIsActive(vm)) {
@@ -2535,9 +2534,8 @@ void qemuProcessKill(virDomainObjPtr vm)
         else
             signum = 0; /* Just check for existence */
 
-        rc = virKillProcess(vm->pid, signum);
-        if (rc < 0) {
-            if (rc != -ESRCH) {
+        if (virKillProcess(vm->pid, signum) < 0) {
+            if (errno != -ESRCH) {
                 char ebuf[1024];
                 VIR_WARN("Failed to kill process %d %s",
                          vm->pid, virStrerror(errno, ebuf, sizeof ebuf));
-- 
1.7.4.4




More information about the libvir-list mailing list