diff options
Diffstat (limited to 'plugins/t')
0 files changed, 0 insertions, 0 deletions
diff --git a/plugins/check_disk.c b/plugins/check_disk.c index f696672..bd06021 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c | |||
@@ -233,9 +233,10 @@ process_arguments (int argc, char **argv) | |||
233 | struct name_list **fstail = &fs_exclude_list; | 233 | struct name_list **fstail = &fs_exclude_list; |
234 | struct name_list **dptail = &dp_exclude_list; | 234 | struct name_list **dptail = &dp_exclude_list; |
235 | struct name_list *temp_list; | 235 | struct name_list *temp_list; |
236 | unsigned long l; | ||
237 | int result = OK; | 236 | int result = OK; |
238 | 237 | ||
238 | unsigned long l; | ||
239 | |||
239 | int option_index = 0; | 240 | int option_index = 0; |
240 | static struct option long_options[] = { | 241 | static struct option long_options[] = { |
241 | {"timeout", required_argument, 0, 't'}, | 242 | {"timeout", required_argument, 0, 't'}, |
@@ -322,6 +323,8 @@ process_arguments (int argc, char **argv) | |||
322 | usage (_("Critical threshold must be integer or percentage!\n")); | 323 | usage (_("Critical threshold must be integer or percentage!\n")); |
323 | } | 324 | } |
324 | case 'u': | 325 | case 'u': |
326 | if (units) | ||
327 | free(units); | ||
325 | if (! strcmp (optarg, "bytes")) { | 328 | if (! strcmp (optarg, "bytes")) { |
326 | mult = (uintmax_t)1; | 329 | mult = (uintmax_t)1; |
327 | units = strdup ("B"); | 330 | units = strdup ("B"); |
@@ -340,13 +343,19 @@ process_arguments (int argc, char **argv) | |||
340 | } else { | 343 | } else { |
341 | die (STATE_UNKNOWN, _("unit type %s not known\n"), optarg); | 344 | die (STATE_UNKNOWN, _("unit type %s not known\n"), optarg); |
342 | } | 345 | } |
346 | if (units == NULL) | ||
347 | die (STATE_UNKNOWN, _("failed allocating storage for '%s'\n"), "units"); | ||
343 | break; | 348 | break; |
344 | case 'k': /* display mountpoint */ | 349 | case 'k': /* display mountpoint */ |
345 | mult = 1024; | 350 | mult = 1024; |
351 | if (units) | ||
352 | free(units); | ||
346 | units = strdup ("kB"); | 353 | units = strdup ("kB"); |
347 | break; | 354 | break; |
348 | case 'm': /* display mountpoint */ | 355 | case 'm': /* display mountpoint */ |
349 | mult = 1024 * 1024; | 356 | mult = 1024 * 1024; |
357 | if (units) | ||
358 | free(units); | ||
350 | units = strdup ("kB"); | 359 | units = strdup ("kB"); |
351 | break; | 360 | break; |
352 | case 'l': | 361 | case 'l': |
@@ -475,8 +484,10 @@ INPUT ERROR: C_DF (%lu) should be less than W_DF (%lu) and both should be greate | |||
475 | return ERROR; | 484 | return ERROR; |
476 | } | 485 | } |
477 | 486 | ||
478 | if (units == NULL) | 487 | if (units == NULL) { |
479 | units = strdup ("MB"); | 488 | units = strdup ("MB"); |
489 | mult = (uintmax_t)1024 * 1024; | ||
490 | } | ||
480 | return OK; | 491 | return OK; |
481 | } | 492 | } |
482 | 493 | ||
diff --git a/plugins/netutils.c b/plugins/netutils.c index 92fd142..58b3fb4 100644 --- a/plugins/netutils.c +++ b/plugins/netutils.c | |||
@@ -53,8 +53,8 @@ socket_timeout_alarm_handler (int sig) | |||
53 | /* connects to a host on a specified TCP port, sends a string, | 53 | /* connects to a host on a specified TCP port, sends a string, |
54 | and gets a response */ | 54 | and gets a response */ |
55 | int | 55 | int |
56 | process_tcp_request (char *server_address, int server_port, | 56 | process_tcp_request (const char *server_address, int server_port, |
57 | char *send_buffer, char *recv_buffer, int recv_size) | 57 | const char *send_buffer, char *recv_buffer, int recv_size) |
58 | { | 58 | { |
59 | int result; | 59 | int result; |
60 | 60 | ||
@@ -68,8 +68,8 @@ process_tcp_request (char *server_address, int server_port, | |||
68 | /* connects to a host on a specified UDP port, sends a string, and gets a | 68 | /* connects to a host on a specified UDP port, sends a string, and gets a |
69 | response */ | 69 | response */ |
70 | int | 70 | int |
71 | process_udp_request (char *server_address, int server_port, | 71 | process_udp_request (const char *server_address, int server_port, |
72 | char *send_buffer, char *recv_buffer, int recv_size) | 72 | const char *send_buffer, char *recv_buffer, int recv_size) |
73 | { | 73 | { |
74 | int result; | 74 | int result; |
75 | 75 | ||
@@ -85,8 +85,8 @@ process_udp_request (char *server_address, int server_port, | |||
85 | response. loops on select-recv until timeout or eof to get all of a | 85 | response. loops on select-recv until timeout or eof to get all of a |
86 | multi-packet answer */ | 86 | multi-packet answer */ |
87 | int | 87 | int |
88 | process_tcp_request2 (char *server_address, int server_port, | 88 | process_tcp_request2 (const char *server_address, int server_port, |
89 | char *send_buffer, char *recv_buffer, int recv_size) | 89 | const char *send_buffer, char *recv_buffer, int recv_size) |
90 | { | 90 | { |
91 | 91 | ||
92 | int result; | 92 | int result; |
@@ -163,8 +163,8 @@ process_tcp_request2 (char *server_address, int server_port, | |||
163 | /* connects to a host on a specified port, sends a string, and gets a | 163 | /* connects to a host on a specified port, sends a string, and gets a |
164 | response */ | 164 | response */ |
165 | int | 165 | int |
166 | process_request (char *server_address, int server_port, int proto, | 166 | process_request (const char *server_address, int server_port, int proto, |
167 | char *send_buffer, char *recv_buffer, int recv_size) | 167 | const char *send_buffer, char *recv_buffer, int recv_size) |
168 | { | 168 | { |
169 | int result; | 169 | int result; |
170 | int send_result; | 170 | int send_result; |
@@ -223,7 +223,7 @@ process_request (char *server_address, int server_port, int proto, | |||
223 | 223 | ||
224 | /* opens a connection to a remote host/tcp port */ | 224 | /* opens a connection to a remote host/tcp port */ |
225 | int | 225 | int |
226 | my_tcp_connect (char *host_name, int port, int *sd) | 226 | my_tcp_connect (const char *host_name, int port, int *sd) |
227 | { | 227 | { |
228 | int result; | 228 | int result; |
229 | 229 | ||
@@ -235,7 +235,7 @@ my_tcp_connect (char *host_name, int port, int *sd) | |||
235 | 235 | ||
236 | /* opens a connection to a remote host/udp port */ | 236 | /* opens a connection to a remote host/udp port */ |
237 | int | 237 | int |
238 | my_udp_connect (char *host_name, int port, int *sd) | 238 | my_udp_connect (const char *host_name, int port, int *sd) |
239 | { | 239 | { |
240 | int result; | 240 | int result; |
241 | 241 | ||
@@ -247,7 +247,7 @@ my_udp_connect (char *host_name, int port, int *sd) | |||
247 | 247 | ||
248 | /* opens a tcp or udp connection to a remote host */ | 248 | /* opens a tcp or udp connection to a remote host */ |
249 | int | 249 | int |
250 | my_connect (char *host_name, int port, int *sd, int proto) | 250 | my_connect (const char *host_name, int port, int *sd, int proto) |
251 | { | 251 | { |
252 | struct addrinfo hints; | 252 | struct addrinfo hints; |
253 | struct addrinfo *res; | 253 | struct addrinfo *res; |
@@ -315,7 +315,7 @@ my_connect (char *host_name, int port, int *sd, int proto) | |||
315 | } | 315 | } |
316 | 316 | ||
317 | int | 317 | int |
318 | is_host (char *address) | 318 | is_host (const char *address) |
319 | { | 319 | { |
320 | if (is_addr (address) || is_hostname (address)) | 320 | if (is_addr (address) || is_hostname (address)) |
321 | return (TRUE); | 321 | return (TRUE); |
@@ -324,7 +324,7 @@ is_host (char *address) | |||
324 | } | 324 | } |
325 | 325 | ||
326 | int | 326 | int |
327 | is_addr (char *address) | 327 | is_addr (const char *address) |
328 | { | 328 | { |
329 | #ifdef USE_IPV6 | 329 | #ifdef USE_IPV6 |
330 | if (is_inet_addr (address) && address_family != AF_INET6) | 330 | if (is_inet_addr (address) && address_family != AF_INET6) |
@@ -342,7 +342,7 @@ is_addr (char *address) | |||
342 | } | 342 | } |
343 | 343 | ||
344 | int | 344 | int |
345 | resolve_host_or_addr (char *address, int family) | 345 | resolve_host_or_addr (const char *address, int family) |
346 | { | 346 | { |
347 | struct addrinfo hints; | 347 | struct addrinfo hints; |
348 | struct addrinfo *res; | 348 | struct addrinfo *res; |
@@ -361,21 +361,21 @@ resolve_host_or_addr (char *address, int family) | |||
361 | } | 361 | } |
362 | 362 | ||
363 | int | 363 | int |
364 | is_inet_addr (char *address) | 364 | is_inet_addr (const char *address) |
365 | { | 365 | { |
366 | return resolve_host_or_addr (address, AF_INET); | 366 | return resolve_host_or_addr (address, AF_INET); |
367 | } | 367 | } |
368 | 368 | ||
369 | #ifdef USE_IPV6 | 369 | #ifdef USE_IPV6 |
370 | int | 370 | int |
371 | is_inet6_addr (char *address) | 371 | is_inet6_addr (const char *address) |
372 | { | 372 | { |
373 | return resolve_host_or_addr (address, AF_INET6); | 373 | return resolve_host_or_addr (address, AF_INET6); |
374 | } | 374 | } |
375 | #endif | 375 | #endif |
376 | 376 | ||
377 | int | 377 | int |
378 | is_hostname (char *s1) | 378 | is_hostname (const char *s1) |
379 | { | 379 | { |
380 | #ifdef USE_IPV6 | 380 | #ifdef USE_IPV6 |
381 | return resolve_host_or_addr (s1, address_family); | 381 | return resolve_host_or_addr (s1, address_family); |
diff --git a/plugins/netutils.h b/plugins/netutils.h index f5df7af..c560f44 100644 --- a/plugins/netutils.h +++ b/plugins/netutils.h | |||
@@ -36,27 +36,27 @@ | |||
36 | 36 | ||
37 | RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn)); | 37 | RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn)); |
38 | 38 | ||
39 | int process_tcp_request2 (char *address, int port, char *sbuffer, | 39 | int process_tcp_request2 (const char *address, int port, |
40 | char *rbuffer, int rsize); | 40 | const char *sbuffer, char *rbuffer, int rsize); |
41 | int process_tcp_request (char *address, int port, char *sbuffer, | 41 | int process_tcp_request (const char *address, int port, |
42 | char *rbuffer, int rsize); | 42 | const char *sbuffer, char *rbuffer, int rsize); |
43 | int process_udp_request (char *address, int port, char *sbuffer, | 43 | int process_udp_request (const char *address, int port, |
44 | char *rbuffer, int rsize); | 44 | const char *sbuffer, char *rbuffer, int rsize); |
45 | int process_request (char *address, int port, int proto, char *sbuffer, | 45 | int process_request (const char *address, int port, int proto, |
46 | char *rbuffer, int rsize); | 46 | const char *sbuffer, char *rbuffer, int rsize); |
47 | 47 | ||
48 | int my_tcp_connect (char *address, int port, int *sd); | 48 | int my_tcp_connect (const char *address, int port, int *sd); |
49 | int my_udp_connect (char *address, int port, int *sd); | 49 | int my_udp_connect (const char *address, int port, int *sd); |
50 | int my_connect (char *address, int port, int *sd, int proto); | 50 | int my_connect (const char *address, int port, int *sd, int proto); |
51 | 51 | ||
52 | int is_host (char *); | 52 | int is_host (const char *); |
53 | int is_addr (char *); | 53 | int is_addr (const char *); |
54 | int resolve_host_or_addr (char *, int); | 54 | int resolve_host_or_addr (const char *, int); |
55 | int is_inet_addr (char *); | 55 | int is_inet_addr (const char *); |
56 | #ifdef USE_IPV6 | 56 | #ifdef USE_IPV6 |
57 | int is_inet6_addr (char *); | 57 | int is_inet6_addr (const char *); |
58 | #endif | 58 | #endif |
59 | int is_hostname (char *); | 59 | int is_hostname (const char *); |
60 | 60 | ||
61 | extern unsigned int socket_timeout; | 61 | extern unsigned int socket_timeout; |
62 | extern int econn_refuse_state; | 62 | extern int econn_refuse_state; |