diff --git a/configure b/configure
index 4c1110f199b2ffc90df32ae55b2c82344bba7598..f78d56a16287ee448b940b4d33f85911622eb600 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 a040d6db9e614209738aa288b2b0e9049b8b2701..b108f871814cee01cea3d35ff3a6f47c94cfbe6a 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