diff options
-rw-r--r-- | plugins/netutils.c | 7 | ||||
-rw-r--r-- | plugins/netutils.h | 11 |
2 files changed, 12 insertions, 6 deletions
diff --git a/plugins/netutils.c b/plugins/netutils.c index 6082cae0..1d6100ab 100644 --- a/plugins/netutils.c +++ b/plugins/netutils.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include "common.h" | 32 | #include "common.h" |
33 | #include "netutils.h" | 33 | #include "netutils.h" |
34 | 34 | ||
35 | unsigned int socket_timeout = DEFAULT_SOCKET_TIMEOUT; | ||
36 | int econn_refuse_state = STATE_CRITICAL; | 35 | int econn_refuse_state = STATE_CRITICAL; |
37 | int was_refused = FALSE; | 36 | int was_refused = FALSE; |
38 | #if USE_IPV6 | 37 | #if USE_IPV6 |
@@ -46,11 +45,11 @@ void | |||
46 | socket_timeout_alarm_handler (int sig) | 45 | socket_timeout_alarm_handler (int sig) |
47 | { | 46 | { |
48 | if (sig == SIGALRM) | 47 | if (sig == SIGALRM) |
49 | printf (_("CRITICAL - Socket timeout after %d seconds\n"), socket_timeout); | 48 | printf (_("%s - Socket timeout after %d seconds\n"), state_text(socket_timeout_state), socket_timeout); |
50 | else | 49 | else |
51 | printf (_("CRITICAL - Abnormal timeout after %d seconds\n"), socket_timeout); | 50 | printf (_("%s - Abnormal timeout after %d seconds\n"), state_text(socket_timeout_state), socket_timeout); |
52 | 51 | ||
53 | exit (STATE_CRITICAL); | 52 | exit (socket_timeout_state); |
54 | } | 53 | } |
55 | 54 | ||
56 | 55 | ||
diff --git a/plugins/netutils.h b/plugins/netutils.h index 6bc5386c..b479b741 100644 --- a/plugins/netutils.h +++ b/plugins/netutils.h | |||
@@ -45,8 +45,6 @@ | |||
45 | # endif /* UNIX_PATH_MAX */ | 45 | # endif /* UNIX_PATH_MAX */ |
46 | #endif /* HAVE_SYS_UN_H */ | 46 | #endif /* HAVE_SYS_UN_H */ |
47 | 47 | ||
48 | RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn)); | ||
49 | |||
50 | /* process_request and wrapper macros */ | 48 | /* process_request and wrapper macros */ |
51 | #define process_tcp_request(addr, port, sbuf, rbuf, rsize) \ | 49 | #define process_tcp_request(addr, port, sbuf, rbuf, rsize) \ |
52 | process_request(addr, port, IPPROTO_TCP, sbuf, rbuf, rsize) | 50 | process_request(addr, port, IPPROTO_TCP, sbuf, rbuf, rsize) |
@@ -83,7 +81,16 @@ void host_or_die(const char *str); | |||
83 | # define is_hostname(addr) resolve_host_or_addr(addr, AF_INET) | 81 | # define is_hostname(addr) resolve_host_or_addr(addr, AF_INET) |
84 | #endif | 82 | #endif |
85 | 83 | ||
84 | #ifdef LOCAL_TIMEOUT_ALARM_HANDLER | ||
86 | extern unsigned int socket_timeout; | 85 | extern unsigned int socket_timeout; |
86 | extern int socket_timeout_state; | ||
87 | RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn)); | ||
88 | #else | ||
89 | unsigned int socket_timeout = DEFAULT_SOCKET_TIMEOUT; | ||
90 | unsigned int socket_timeout_state = STATE_CRITICAL; | ||
91 | extern RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn)); | ||
92 | #endif | ||
93 | |||
87 | extern int econn_refuse_state; | 94 | extern int econn_refuse_state; |
88 | extern int was_refused; | 95 | extern int was_refused; |
89 | extern int address_family; | 96 | extern int address_family; |