Re: [PATCH 09/16] qemu: Convert virExec usage to virCommand

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]