mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 02:51:16 +00:00
src/qemu_driver.c: Handle errors from fork(2) and pipe(2)
system calls when creating qemu subprocess.
This commit is contained in:
parent
09f1c2041d
commit
407df0f164
@ -1,3 +1,8 @@
|
||||
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 (qemudWaitForMonitor(conn, driver, vm) < 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;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int qemudVMData(struct qemud_driver *driver ATTRIBUTE_UNUSED,
|
||||
|
Loading…
Reference in New Issue
Block a user