From 08829f2940e6322cbe423e7cd73bc1c48474fc59 Mon Sep 17 00:00:00 2001
From: Tim Wickberg <tim@schedmd.com>
Date: Thu, 9 Jun 2016 10:22:31 -0400
Subject: [PATCH] Fix qstat wrapper script to return 153 when no results found.

Except return 0 if using the -u argument. Bug introduced by addb35749,
fix bug 2330 differently while solving bug 2807.
---
 configure                | 7 ++++---
 contribs/torque/qstat.pl | 7 ++++++-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/configure b/configure
index 4c1110f199b..f78d56a1628 100755
--- a/configure
+++ b/configure
@@ -20240,9 +20240,10 @@ char *malloc ();
 int
 main ()
 {
-return ! malloc (0);
-  ;
-  return 0;
+char *a = malloc(0);
+int b = !a;
+free(a);
+return b;
 }
 _ACEOF
 if ac_fn_c_try_run "$LINENO"; then :
diff --git a/contribs/torque/qstat.pl b/contribs/torque/qstat.pl
index a040d6db9e6..b108f871814 100755
--- a/contribs/torque/qstat.pl
+++ b/contribs/torque/qstat.pl
@@ -227,8 +227,13 @@ if(defined($queueList)) {
 			print_job_brief($job, $line);
 			$line++;
 		}
+		$rc = 0;
+	}
+
+	# return 0 even if no records printed when using -u flag
+	if (@userIds) {
+		$rc = 0;
 	}
-	$rc = 0;
 }
 
 # Exit with status code
-- 
GitLab