]> git.ipfire.org Git - thirdparty/libvirt.git/commit
fdstream: avoid double close bug
authorEric Blake <eblake@redhat.com>
Wed, 30 May 2012 15:20:37 +0000 (09:20 -0600)
committerEric Blake <eblake@redhat.com>
Thu, 31 May 2012 03:41:46 +0000 (21:41 -0600)
commitf3cfc7c8848006b613e09bb1acd081716854527e
tree3a61835a5c8620dfef3e96d955d16dd265b96480
parentda831afcf2f6c0d3ed1ea3128a6208f548a05d8f
fdstream: avoid double close bug

Wen Congyang reported that we have a double-close bug if we fail
virFDStreamOpenInternal, since childfd duplicated one of the fds[]
array contents.  In truth, since we always transfer both members
of fds to other variables, we should close the fds through those
other names, and just use fds[] for pipe().

Bug present since 0.9.0 (commit e886237a).

* src/fdstream.c (virFDStreamOpenFileInternal): Swap scope of
childfd and fds[], to avoid a double close.
src/fdstream.c