diff options
author | 2010-01-07 00:16:31 +0000 | |
---|---|---|
committer | 2010-01-07 00:16:31 +0000 | |
commit | 6e2cdf0d30c4ba6c86d6fa67cf47001506e12677 (patch) | |
tree | 37e761a6bef121082e4aeab4bf6486df72475256 /paludis | |
parent | 6461dbbcb47c6b1be786eb5c3d5a39f97f5dfb3d (diff) | |
download | paludis-6e2cdf0d30c4ba6c86d6fa67cf47001506e12677.tar.gz paludis-6e2cdf0d30c4ba6c86d6fa67cf47001506e12677.tar.xz |
Can close() dup()ed fd sources too
Diffstat (limited to 'paludis')
-rw-r--r-- | paludis/util/system.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/paludis/util/system.cc b/paludis/util/system.cc index e17fd93fa..918fba951 100644 --- a/paludis/util/system.cc +++ b/paludis/util/system.cc @@ -611,11 +611,13 @@ paludis::run_command(const Command & cmd) { if (-1 == dup2(captured_stdout->write_fd(), 1)) throw RunCommandError("captured stdout dup2 failed: " + stringify(strerror(errno))); + close(captured_stdout->write_fd()); } else if (-1 != stdout_write_fd) { if (-1 == dup2(stdout_write_fd, 1)) throw RunCommandError("stdout dup2 failed: " + stringify(strerror(errno))); + close(stdout_write_fd); if (-1 != stdout_close_fd) close(stdout_close_fd); @@ -625,11 +627,13 @@ paludis::run_command(const Command & cmd) { if (-1 == dup2(captured_stderr->write_fd(), 2)) throw RunCommandError("captured stderr dup2 failed: " + stringify(strerror(errno))); + close(captured_stderr->write_fd()); } else if (-1 != stderr_write_fd) { if (-1 == dup2(stderr_write_fd, 2)) throw RunCommandError("stderr dup2 failed: " + stringify(strerror(errno))); + close(stderr_write_fd); if (-1 != stderr_close_fd) close(stderr_close_fd); |