[libvirt] [PATCH] Initialize vm def monitor fd

We weren't properly initializing the monitor fd value in the VM definition structure. If qemu failed to start up, this could lead to closing stdin, which made all sorts of poo hit the fan. The attached patch fixes this. Thanks, Cole

Cole Robinson <crobinso@redhat.com> wrote:
We weren't properly initializing the monitor fd value in the VM definition structure. If qemu failed to start up, this could lead to closing stdin, which made all sorts of poo hit the fan. The attached patch fixes this.
diff --git a/src/domain_conf.c b/src/domain_conf.c index e46bf43..622665c 100644 --- a/src/domain_conf.c +++ b/src/domain_conf.c @@ -504,6 +504,7 @@ virDomainObjPtr virDomainAssignDef(virConnectPtr conn, domain->state = VIR_DOMAIN_SHUTOFF; domain->def = def; domain->monitor_watch = -1; + domain->monitor = -1;
if (VIR_REALLOC_N(doms->objs, doms->count + 1) < 0) { virReportOOMError(conn);
Looks fine, but you know me... I want proof -- and a test ;-) Do you have a reproducer?

Cole Robinson <crobinso@redhat.com> wrote:
We weren't properly initializing the monitor fd value in the VM definition structure. If qemu failed to start up, this could lead to closing stdin, which made all sorts of poo hit the fan. The attached patch fixes this.
Thanks, Cole
diff --git a/src/domain_conf.c b/src/domain_conf.c index e46bf43..622665c 100644 --- a/src/domain_conf.c +++ b/src/domain_conf.c @@ -504,6 +504,7 @@ virDomainObjPtr virDomainAssignDef(virConnectPtr conn, domain->state = VIR_DOMAIN_SHUTOFF; domain->def = def; domain->monitor_watch = -1; + domain->monitor = -1;
BTW, this is part of Daniel Berrange's "Fix multiple bugs in RPC handling" patch, so I already have a reproducer for it.

On Mon, Feb 16, 2009 at 06:41:37PM -0500, Cole Robinson wrote:
We weren't properly initializing the monitor fd value in the VM definition structure. If qemu failed to start up, this could lead to closing stdin, which made all sorts of poo hit the fan. The attached patch fixes this.
Already committed this fix Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

Daniel P. Berrange wrote:
On Mon, Feb 16, 2009 at 06:41:37PM -0500, Cole Robinson wrote:
We weren't properly initializing the monitor fd value in the VM definition structure. If qemu failed to start up, this could lead to closing stdin, which made all sorts of poo hit the fan. The attached patch fixes this.
Already committed this fix
Hmm, must have missed the patch go by. Sorry for the noise. - Cole
participants (3)
-
Cole Robinson
-
Daniel P. Berrange
-
Jim Meyering