提交 407df0f1 编写于 作者: R Richard W.M. Jones

src/qemu_driver.c: Handle errors from fork(2) and pipe(2)

          system calls when creating qemu subprocess.
上级 09f1c204
Tue Apr 8 13:24:00 BST 2008 Richard W.M. Jones <rjones@redhat.com>
* src/qemu_driver.c: Handle errors from fork(2) and pipe(2)
system calls when creating qemu subprocess.
Tue Apr 8 11:50:42 CEST 2008 Daniel Veillard <daniel@veillard.com>
* po/sr.po po/sr@Latn.po po/sr@latin.po: fix/update serbian
......
......@@ -603,7 +603,7 @@ static int qemudStartVMDaemon(virConnectPtr conn,
struct qemud_driver *driver,
struct qemud_vm *vm) {
char **argv = NULL, **tmp;
int i;
int i, ret;
char logfile[PATH_MAX];
if (qemudIsActiveVM(vm)) {
......@@ -681,8 +681,9 @@ static int qemudStartVMDaemon(virConnectPtr conn,
qemudLog(QEMUD_WARN, _("Unable to write argv to logfile %d: %s"),
errno, strerror(errno));
if (virExecNonBlock(conn, argv, &vm->pid,
vm->stdin, &vm->stdout, &vm->stderr) == 0) {
ret = virExecNonBlock(conn, argv, &vm->pid,
vm->stdin, &vm->stdout, &vm->stderr);
if (ret == 0) {
vm->id = driver->nextvmid++;
vm->state = vm->migrateFrom[0] ? VIR_DOMAIN_PAUSED : VIR_DOMAIN_RUNNING;
......@@ -704,28 +705,30 @@ static int qemudStartVMDaemon(virConnectPtr conn,
vm->ntapfds = 0;
}
if (virEventAddHandle(vm->stdout,
POLLIN | POLLERR | POLLHUP,
qemudDispatchVMEvent,
driver) < 0) {
qemudShutdownVMDaemon(conn, driver, vm);
return -1;
}
if (ret == 0) {
if (virEventAddHandle(vm->stdout,
POLLIN | POLLERR | POLLHUP,
qemudDispatchVMEvent,
driver) < 0) {
qemudShutdownVMDaemon(conn, driver, vm);
return -1;
}
if (virEventAddHandle(vm->stderr,
POLLIN | POLLERR | POLLHUP,
qemudDispatchVMEvent,
driver) < 0) {
qemudShutdownVMDaemon(conn, driver, vm);
return -1;
}
if (virEventAddHandle(vm->stderr,
POLLIN | POLLERR | POLLHUP,
qemudDispatchVMEvent,
driver) < 0) {
qemudShutdownVMDaemon(conn, driver, vm);
return -1;
}
if (qemudWaitForMonitor(conn, driver, vm) < 0) {
qemudShutdownVMDaemon(conn, driver, vm);
return -1;
if (qemudWaitForMonitor(conn, driver, vm) < 0) {
qemudShutdownVMDaemon(conn, driver, vm);
return -1;
}
}
return 0;
return ret;
}
static int qemudVMData(struct qemud_driver *driver ATTRIBUTE_UNUSED,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册