From 2ebc8814d3013250dd5562216cf996dcc066472c Mon Sep 17 00:00:00 2001
From: Don Lipari <lipari1@llnl.gov>
Date: Fri, 12 Nov 2010 21:53:30 +0000
Subject: [PATCH] Fixed bug in sacct displaying derived exit code

---
 contribs/sjobexit/sjobexitmod.pl | 6 +++---
 src/sacct/print.c                | 2 ++
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/contribs/sjobexit/sjobexitmod.pl b/contribs/sjobexit/sjobexitmod.pl
index a103d98762c..cfd055bd5e7 100755
--- a/contribs/sjobexit/sjobexitmod.pl
+++ b/contribs/sjobexit/sjobexitmod.pl
@@ -162,10 +162,10 @@ sub usage
         $base [-h]
         $base [-man]
 
-	-e <exit code>		Show user and all accounts and share usage for named user (required).
-	-r <reason string>	Show account and share usage for named account (required).
+	-e <exit code>		Modify the derived exit code to new value.
+	-r <reason string>	Modify the derived exit string to new value.
 	-c <cluster>		Name of cluster (optional).
-	-l 			list information for a completed job.
+	-l 			List information for a completed job.
 	-h 			Show usage.
 	JobId			The identification number of the job.
 	-man 			Show man page.
diff --git a/src/sacct/print.c b/src/sacct/print.c
index 6c69bc7e50c..398647e41b1 100644
--- a/src/sacct/print.c
+++ b/src/sacct/print.c
@@ -355,6 +355,8 @@ void print_fields(type_t type, void *object)
 			switch(type) {
 			case JOB:
 				tmp_int = job->derived_ec;
+				if (tmp_int == NO_VAL)
+					tmp_int = 0;
 				if (WIFSIGNALED(tmp_int))
 					tmp_int2 = WTERMSIG(tmp_int);
 
-- 
GitLab