Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12:Update
procps.12938
0040-watch-Don-t-leak-extra-fds-to-the-child.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0040-watch-Don-t-leak-extra-fds-to-the-child.patch of Package procps.12938
From 835b6294d18a6ad79ff56aaeb0038bc6d006384b Mon Sep 17 00:00:00 2001 From: Josh Stone <jistone@redhat.com> Date: Tue, 4 Feb 2014 09:46:58 -0800 Subject: [PATCH] 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 | 1 + 1 file changed, 1 insertion(+) diff --git watch.c watch.c index 032dfb7..f0a3ec3 100644 --- watch.c +++ watch.c @@ -387,6 +387,7 @@ static int run_command(char *restrict command, char **restrict command_argv) if (dup2(pipefd[1], 1) < 0) { /* replace stdout with write side of pipe */ xerr(3, _("dup2 failed")); } + close(pipefd[1]); /* once duped, the write fd isn't needed */ dup2(1, 2); /* stderr should default to stdout */ if (flags & WATCH_EXEC) { /* pass command to exec instead of system */ -- 1.7.9.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor