Set close-exe on logfile fd, keep monitor FD open

This commit is contained in:
Daniel P. Berrange 2007-07-23 18:00:33 +00:00
parent daa2369dde
commit ce19db8990
2 changed files with 18 additions and 0 deletions

View File

@ -1,3 +1,8 @@
Mon Jul 23 13:59:12 EST 2007 Daniel P. Berrange <berrange@redhat.com>
* src/qemu_driver.c: keep monitor filehandle open, and set
close-on-exec flag for logfiles.
Mon Jul 23 11:36:12 CEST 2007 Daniel Veillard <veillard@redhat.com>
* docs/virsh.pod virsh.1: update to document VIRSH_DEFAULT_CONNECT_URI

View File

@ -456,6 +456,11 @@ static int qemudOpenMonitor(virConnectPtr conn,
buf, sizeof(buf),
qemudCheckMonitorPrompt,
"monitor");
/* Keep monitor open upon success */
if (ret == 0)
return ret;
error:
close(monfd);
return ret;
@ -617,6 +622,14 @@ static int qemudStartVMDaemon(virConnectPtr conn,
logfile, strerror(errno));
return -1;
}
if (qemudSetCloseExec(vm->logfile) < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"Unable to set VM logfile close-on-exec flag %s",
strerror(errno));
close(vm->logfile);
vm->logfile = -1;
return -1;
}
if (qemudBuildCommandLine(conn, driver, vm, &argv) < 0) {
close(vm->logfile);