mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 03:12:22 +00:00
Fix a couple of problems in last patch
Those were pointed by DanB in his review but not yet fixed * src/qemu/qemu_driver.c: qemudWaitForMonitor() use EnterMonitorWithDriver() and ExitMonitorWithDriver() there * src/qemu/qemu_monitor_text.c: checking fro strdu failure and hash table add error in qemuMonitorTextGetPtyPaths()
This commit is contained in:
parent
60e8977fdd
commit
a7d1eb3c44
@ -1534,10 +1534,10 @@ qemudWaitForMonitor(virConnectPtr conn,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
qemuDomainObjEnterMonitor(vm);
|
||||
qemuDomainObjEnterMonitorWithDriver(driver, vm);
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
ret = qemuMonitorGetPtyPaths(priv->mon, paths);
|
||||
qemuDomainObjExitMonitor(vm);
|
||||
qemuDomainObjExitMonitorWithDriver(driver, vm);
|
||||
|
||||
VIR_DEBUG("qemuMonitorGetPtyPaths returned %i", ret);
|
||||
if (ret == 0) {
|
||||
|
@ -1650,9 +1650,19 @@ int qemuMonitorTextGetPtyPaths(qemuMonitorPtr mon,
|
||||
|
||||
/* Path is everything after needle to the end of the line */
|
||||
*eol = '\0';
|
||||
char *path = needle + strlen(NEEDLE);
|
||||
char *path = strdup(needle + strlen(NEEDLE));
|
||||
if (path == NULL) {
|
||||
virReportOOMError(NULL);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
virHashAddEntry(paths, id, strdup(path));
|
||||
if (virHashAddEntry(paths, id, path) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
_("failed to save chardev path '%s'"),
|
||||
path);
|
||||
VIR_FREE(path);
|
||||
goto cleanup;
|
||||
}
|
||||
#undef NEEDLE
|
||||
|
||||
next:
|
||||
|
Loading…
x
Reference in New Issue
Block a user