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:
Daniel Veillard 2009-12-14 11:05:55 +01:00
parent 60e8977fdd
commit a7d1eb3c44
2 changed files with 14 additions and 4 deletions

View File

@ -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) {

View File

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