[PATCH] fix virsh coredumps when using ext transport

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

 



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@xxxxxxxxxxxxxx>

---
 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

--
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]