]> git.ipfire.org Git - thirdparty/libvirt.git/commit
command: avoid fd leak on failure
authorEric Blake <eblake@redhat.com>
Tue, 12 Jul 2011 20:01:05 +0000 (14:01 -0600)
committerEric Blake <eblake@redhat.com>
Thu, 13 Oct 2011 17:48:42 +0000 (11:48 -0600)
commit219600c94e35fb8863cb40986c4154deebad277f
treeedf22d4d0a73f6cb4c354ec159d0e49492f74eb0
parentd60299c3ecd200e6545606c18bd8922e88bb3a45
command: avoid fd leak on failure

virCommandTransferFD promises that the fd is no longer owned by
the caller.  Normally, we want the fd to remain open until the
child runs, but in error situations, we must close it earlier.

* src/util/command.c (virCommandTransferFD): Close fd now if we
can't track it to close later.
(virCommandKeepFD): Adjust helper to make this easier.
src/util/command.c