From be17696ce2be64154e129b06a1e0af76ff3af6a2 Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Thu, 31 Mar 2005 21:03:17 +0000
Subject: [PATCH] Fix bug in srun to clean-up upon failure of an allocated node
     (srun -A would generate a segmentation fault, Chris Holmes, HP).

---
 NEWS           | 2 ++
 src/srun/msg.c | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 8e64a65b70c..371a97457e9 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,8 @@ documents those changes that are of interest to users and admins.
 
 * Changes in SLURM 0.5.0-pre2
 =============================
+ -- Fix bug in srun to clean-up upon failure of an allocated node
+    (srun -A would generate a segmentation fault, Chris Holmes, HP).
 
 * Changes in SLURM 0.5.0-pre1
 =============================
diff --git a/src/srun/msg.c b/src/srun/msg.c
index 27969561753..059f7083581 100644
--- a/src/srun/msg.c
+++ b/src/srun/msg.c
@@ -207,7 +207,8 @@ static void _node_fail_handler(char *nodelist, job_t *job)
 	update_job_state(job, SRUN_JOB_FORCETERM);
 	info("sending Ctrl-C to remaining tasks");
 	fwd_signal(job, SIGINT);
-	pthread_kill(job->ioid,  SIGHUP);
+	if (job->ioid)
+		pthread_kill(job->ioid,  SIGHUP);
 }
 
 static bool _job_msg_done(job_t *job)
-- 
GitLab