[PATCH v5 12/36] qemu_process: Store libDir in qemuProcessQmp struct

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

 



Store libDir path in the qemuProcessQmp struct in anticipation of moving
path construction code into qemuProcessQmpInit function.

Signed-off-by: Chris Venteicher <cventeic@xxxxxxxxxx>
---
 src/qemu/qemu_process.c | 8 +++++---
 src/qemu/qemu_process.h | 1 +
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index a688be7f2c..d4025ac1bc 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -8115,6 +8115,7 @@ qemuProcessQmpFree(qemuProcessQmpPtr proc)
 
     qemuProcessQmpStop(proc);
     VIR_FREE(proc->binary);
+    VIR_FREE(proc->libDir);
     VIR_FREE(proc->monpath);
     VIR_FREE(proc->monarg);
     VIR_FREE(proc->pidfile);
@@ -8135,7 +8136,8 @@ qemuProcessQmpNew(const char *binary,
     if (VIR_ALLOC(proc) < 0)
         goto error;
 
-    if (VIR_STRDUP(proc->binary, binary) < 0)
+    if (VIR_STRDUP(proc->binary, binary) < 0 ||
+        VIR_STRDUP(proc->libDir, libDir) < 0)
         goto error;
 
 
@@ -8146,7 +8148,7 @@ qemuProcessQmpNew(const char *binary,
     /* the ".sock" sufix is important to avoid a possible clash with a qemu
      * domain called "capabilities"
      */
-    if (virAsprintf(&proc->monpath, "%s/%s", libDir,
+    if (virAsprintf(&proc->monpath, "%s/%s", proc->libDir,
                     "capabilities.monitor.sock") < 0)
         goto error;
     if (virAsprintf(&proc->monarg, "unix:%s,server,nowait", proc->monpath) < 0)
@@ -8158,7 +8160,7 @@ qemuProcessQmpNew(const char *binary,
      * -daemonize we need QEMU to be allowed to create them, rather
      * than libvirtd. So we're using libDir which QEMU can write to
      */
-    if (virAsprintf(&proc->pidfile, "%s/%s", libDir, "capabilities.pidfile") < 0)
+    if (virAsprintf(&proc->pidfile, "%s/%s", proc->libDir, "capabilities.pidfile") < 0)
         goto error;
 
     virPidFileForceCleanupPath(proc->pidfile);
diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h
index 1b64aeef4e..9967766120 100644
--- a/src/qemu/qemu_process.h
+++ b/src/qemu/qemu_process.h
@@ -218,6 +218,7 @@ typedef struct _qemuProcessQmp qemuProcessQmp;
 typedef qemuProcessQmp *qemuProcessQmpPtr;
 struct _qemuProcessQmp {
     char *binary;
+    char *libDir;
     uid_t runUid;
     gid_t runGid;
     int status;
-- 
2.17.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]

  Powered by Linux