On 05/10/2011 02:07 PM, Cole Robinson wrote:
- if (virExec(intermediate_argv, NULL, NULL,
- &intermediate_pid, intermediatefd, fd, NULL, 0) < 0) {
+
+ virCommandSetInputFD(cmd, intermediatefd);
+ virCommandSetOutputFD(cmd, fd);
+
+ if (virCommandRunAsync(cmd, &intermediate_pid) < 0) {
Either pass NULL for the intermediate_pid (which means that
virCommandFree will auto-cleanup the child process), or add a call to
virCommandWait() or waitpid() along all control flow paths; otherwise
you risk leaking a child process. See how I did it in qemu_migration.c.
Also, you may want to simplify patches 7 and 8 to take advantage of the
virCommandFree auto-cleanup when you use a NULL pid argument.
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org