[libvirt] [PATCH] fix virsh coredumps when using ext transport

Wen Congyang wency at cn.fujitsu.com
Wed Dec 22 09:25:58 UTC 2010


when we use an external process to connect remote libvirtd,
virsh will coredump:

# virsh -c qemu+ext://<target_ip>/system?command=cmd
Segmentation fault (core dumped)

This bug was caused by 3348a97b.

Signed-off-by: Wen Congyang <wency at cn.fujitsu.com>

---
 src/remote/remote_driver.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index fae191c..1c13f4a 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -802,6 +802,18 @@ doRemoteOpen (virConnectPtr conn,
             goto failed;
         }
 
+        /* Run the external process. */
+        if (!cmd_argv) {
+            if (VIR_ALLOC_N(cmd_argv, 2) < 0)
+                goto out_of_memory;
+
+            cmd_argv[0] = strdup(command);
+            if (cmd_argv[0] == NULL)
+                goto out_of_memory;
+
+            cmd_argv[1] = NULL;
+        }
+
         if (virExec((const char**)cmd_argv, NULL, NULL,
                     &pid, sv[1], &(sv[1]), &(errfd[1]),
                     VIR_EXEC_CLEAR_CAPS) < 0)
-- 
1.7.1




More information about the libvir-list mailing list