فهرست منبع

Merge branch 'master' into icmperfdata

Sebastian Wolf 4 سال پیش
والد
کامیت
caef6d091b
2فایلهای تغییر یافته به همراه4 افزوده شده و 10 حذف شده
  1. 1 0
      NEWS
  2. 3 10
      plugins/negate.c

+ 1 - 0
NEWS

@@ -4,6 +4,7 @@ This file documents the major additions and syntax changes between releases.
 	pst3.c: Fix build issue on Solaris (#537)
 	pst3.c: Fix build issue on Solaris (#537)
 	check_log: Fix error message for systems that don't use bash (#539)
 	check_log: Fix error message for systems that don't use bash (#539)
 	check_icmp: Add -f and -F perfdata options (#567)
 	check_icmp: Add -f and -F perfdata options (#567)
+	negate: Errors are now printed directly to stderr instead of being redirected to stdout (#571) (Geert Hendrickx)
 
 
 2.3.3 2020-03-11
 2.3.3 2020-03-11
 	FIXES
 	FIXES

+ 3 - 10
plugins/negate.c

@@ -85,17 +85,10 @@ main (int argc, char **argv)
 	} else {
 	} else {
 		result = cmd_run_array (command_line, &chld_out, &chld_err, 0);
 		result = cmd_run_array (command_line, &chld_out, &chld_err, 0);
 	}
 	}
-	if (chld_err.lines > 0) {
-		printf ("Error output from command:\n");
-		for (i = 0; i < chld_err.lines; i++) {
-			printf ("%s\n", chld_err.line[i]);
-		}
-		exit (STATE_WARNING);
-	}
 
 
-	/* Return UNKNOWN or worse if no output is returned */
-	if (chld_out.lines == 0)
-		die (max_state_alt (result, STATE_UNKNOWN), _("No data returned from command\n"));
+	for (i = 0; i < chld_err.lines; i++) {
+		fprintf (stderr, "%s\n", chld_err.line[i]);
+	}
 
 
 	for (i = 0; i < chld_out.lines; i++) {
 	for (i = 0; i < chld_out.lines; i++) {
 		if (subst_text && result >= 0 && result <= 3 && result != state[result])  {
 		if (subst_text && result >= 0 && result <= 3 && result != state[result])  {