Store libDir path in the qemuProcessQMP struct in anticipation of moving
path construction code into qemuProcessQMPInit 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 5492ff5a19..dc2237f0e6 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -8211,6 +8211,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);
@@ -8231,7 +8232,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;
proc->runUid = runUid;
@@ -8241,7 +8243,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)
@@ -8253,7 +8255,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 9938dd0a69..e07584c11c 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