watch: Don't leak extra fds to the child
authorJosh Stone <jistone@redhat.com>
Tue, 15 Oct 2013 03:26:08 +0000 (20:26 -0700)
committerJosh Stone <jistone@redhat.com>
Tue, 15 Oct 2013 03:26:08 +0000 (20:26 -0700)
commit6ace571e80aa50f7224e1f26303bc9453e55ef08
treee877499f2c49bab8d5448319d35b98f63b7411ef
parentf5d15f471890ed8ae1006b0007ff1bc7a5b9476d
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