2011/6/14 Eric Blake <eblake@xxxxxxxxxx>: > Previously, the parent process opened 'null' to /dev/null, then > the child process closes 'null' as well as 'childout'. ÂBut if > childout was set to be null, then this is a double close. ÂAt > least the double close was confined to the child process after a > fork, and therefore there is no risk of another thread opening > an fd of the same value to be bitten by the double close, but it > is always better to avoid double-close to begin with. > > Additionally, if all three fds were specified, then opening > 'null' was wasted. > > This patch fixes things to lazily open null on the first use, > then guarantees it gets closed exactly once. > > * src/util/command.c (getDevNull): New helper function. > (virExecWithHook): Use it to avoid spurious opens and double close. > --- > Âsrc/util/command.c | Â 44 ++++++++++++++++++++++++++++++++------------ > Â1 files changed, 32 insertions(+), 12 deletions(-) > ACK. -- Matthias Bolte http://photron.blogspot.com -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list