From 20094eaacc66ff5cb65e17648e6e231f73388d73 Mon Sep 17 00:00:00 2001 From: "K. Noel Belcourt" Date: Thu, 7 Jan 2010 05:57:33 +0000 Subject: [PATCH] This patch ensures we close both file descriptors following the dup2 calls. This is mostly for completeness but also because I've occasionally noticed output isn't flushed from a terminated process (when it is killed for exceeding the time limit). I'm sure this won't break anything and am slightly hopeful that it might ensure output is flushed before the terminating process is killed. [SVN r58785] --- src/engine/execunix.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/engine/execunix.c b/src/engine/execunix.c index 87da9b816..90736baf4 100644 --- a/src/engine/execunix.c +++ b/src/engine/execunix.c @@ -226,13 +226,13 @@ void exec_cmd dup2( out[1], STDOUT_FILENO ); if ( globs.pipe_action == 0 ) - { dup2( out[1], STDERR_FILENO ); - close( err[1] ); - } else dup2( err[1], STDERR_FILENO ); + close( out[1] ); + close( err[1] ); + /* Make this process a process group leader so that when we kill it, all * child processes of this process are terminated as well. We use * killpg(pid, SIGKILL) to kill the process group leader and all its