فهرست منبع

Make alarm handler customisable

Thomas Guyot-Sionnest 17 سال پیش
والد
کامیت
c459ca0770
2فایلهای تغییر یافته به همراه5 افزوده شده و 3 حذف شده
  1. 3 3
      plugins/utils.c
  2. 2 0
      plugins/utils.h

+ 3 - 3
plugins/utils.c

@@ -168,9 +168,9 @@ void
 timeout_alarm_handler (int signo)
 {
 	if (signo == SIGALRM) {
-		printf (_("CRITICAL - Plugin timed out after %d seconds\n"),
-						timeout_interval);
-		exit (STATE_CRITICAL);
+		printf (_("%s - Plugin timed out after %d seconds\n"),
+						state_text(timeout_state), timeout_interval);
+		exit (timeout_state);
 	}
 }
 

+ 2 - 0
plugins/utils.h

@@ -32,9 +32,11 @@ void print_revision (const char *, const char *);
 /* Handle timeouts */
 
 #ifdef LOCAL_TIMEOUT_ALARM_HANDLER
+extern unsigned int timeout_state;
 extern unsigned int timeout_interval;
 RETSIGTYPE timeout_alarm_handler (int);
 #else
+unsigned int timeout_state = STATE_CRITICAL;
 unsigned int timeout_interval = DEFAULT_SOCKET_TIMEOUT;
 extern RETSIGTYPE timeout_alarm_handler (int);
 #endif