From a65861a4ecdaeab4040ea39e94015f9e754fd972 Mon Sep 17 00:00:00 2001
From: Danny Auble <da@llnl.gov>
Date: Tue, 22 Aug 2006 18:30:17 +0000
Subject: [PATCH] patch from Hongia Cao on 8/21/06

---
 src/srun/srun.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/srun/srun.c b/src/srun/srun.c
index 1bf96b64a71..ca6461fa1b8 100644
--- a/src/srun/srun.c
+++ b/src/srun/srun.c
@@ -367,7 +367,9 @@ int srun(int ac, char **av)
 	/*
 	 *  We want to make sure we get the correct state of the job
 	 *  and not finish before all the messages have been sent.
-	 */	
+	 */
+	if (job->state == SRUN_JOB_FAILED)
+		close(job->forked_msg->msg_par->msg_pipe[1]);
 	debug("Waiting for message thread");
 	if (pthread_join(job->jtid, NULL) < 0)
 		error ("Waiting on message thread: %m");
-- 
GitLab