Store libDir path in the qemuProcess struct in anticipation of moving
path construction code into qemuProcessInitQmp function.
Signed-off-by: Chris Venteicher <cventeic(a)redhat.com>
---
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 f109e6e19b..804ec998af 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -8085,6 +8085,7 @@ qemuProcessFree(qemuProcessPtr proc)
qemuProcessStopQmp(proc);
VIR_FREE(proc->binary);
+ VIR_FREE(proc->libDir);
VIR_FREE(proc->monpath);
VIR_FREE(proc->monarg);
VIR_FREE(proc->pidfile);
@@ -8105,7 +8106,8 @@ qemuProcessNew(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;
proc->forceTCG = forceTCG;
@@ -8116,7 +8118,7 @@ qemuProcessNew(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)
@@ -8128,7 +8130,7 @@ qemuProcessNew(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 c34ca52ef5..1b8f743861 100644
--- a/src/qemu/qemu_process.h
+++ b/src/qemu/qemu_process.h
@@ -218,6 +218,7 @@ typedef struct _qemuProcess qemuProcess;
typedef qemuProcess *qemuProcessPtr;
struct _qemuProcess {
char *binary;
+ char *libDir;
uid_t runUid;
gid_t runGid;
char *qmperr; /* qemu process stderr */
--
2.17.1