2011/6/14 Eric Blake <ebl...@redhat.com>: > 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@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list