[libvirt] PATCH: Set stdout/err to /dev/null for spawned children

If passing a 'NULL' to virExec() for the stdout/err file descriptor it is intended that the child process get connected to /dev/null. This behaviour was previously broken when built with DEBUG enabled, and with Amy's recent logging change, it is now permanently broken. The problem this causes, is that the child process ends up still connected to the parent app's stderr/out. This causes things like Perl's test harness to hang waiting for end of file that will never come while libvirtd is running. THis patch puts virExec back to its original documented behaviour Daniel src/util.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/src/util.c b/src/util.c index f82cddc..178ff0c 100644 --- a/src/util.c +++ b/src/util.c @@ -376,6 +376,8 @@ __virExec(virConnectPtr conn, } else { childout = *outfd; } + } else { + childout = null; } if (errfd != NULL) { @@ -403,6 +405,8 @@ __virExec(virConnectPtr conn, } else { childerr = *errfd; } + } else { + childerr = null; } if ((pid = fork()) < 0) { -- 1.6.2.5 -- |: 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 :|

On Tue, Jul 07, 2009 at 05:36:35PM +0100, Daniel P. Berrange wrote:
If passing a 'NULL' to virExec() for the stdout/err file descriptor it is intended that the child process get connected to /dev/null. This behaviour was previously broken when built with DEBUG enabled, and with Amy's recent logging change, it is now permanently broken. The problem this causes, is that the child process ends up still connected to the parent app's stderr/out. This causes things like Perl's test harness to hang waiting for end of file that will never come while libvirtd is running. THis patch puts virExec back to its original documented behaviour
Oh, I see, nasty, ACK ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/
participants (2)
-
Daniel P. Berrange
-
Daniel Veillard