watch: Don't leak extra fds to the child
authorJosh Stone <jistone@redhat.com>
Tue, 4 Feb 2014 17:46:58 +0000 (09:46 -0800)
committerJaromir Capik <jcapik@redhat.com>
Tue, 4 Feb 2014 18:23:59 +0000 (19:23 +0100)
commit835b6294d18a6ad79ff56aaeb0038bc6d006384b
tree9310df3c534857d4ee2d2c392b8195b1e69bad40
parent4fcd56bf582ee2ef5b205625ca3d1bfed90364e9
watch: Don't leak extra fds to the child

Once the write side of the pipe has been duped to stdout for the child,
the original pipefd is no longer needed, so it can be closed to avoid
leaking to the child.

The leak can easily be seen with "watch ls -l /proc/self/fd", but I
found this due to "watch lvs" diagnosing itself:

    File descriptor 4 (pipe:[3163616]) leaked on lvs invocation.

Signed-off-by: Josh Stone <jistone@redhat.com>
watch.c