summaryrefslogtreecommitdiffstats
path: root/plugins-root/check_icmp.c
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-06-20 10:04:34 +0200
committerLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-06-20 10:04:34 +0200
commit2bea8e9522af1c454d1a6a618402f9f342730406 (patch)
treeea18c8e0cefd18ab3694540a321811e62ff8adac /plugins-root/check_icmp.c
parent20e938bb542d361ad1468ab24330f554445aefb1 (diff)
downloadmonitoring-plugins-2bea8e9522af1c454d1a6a618402f9f342730406.tar.gz
check_icmp: Remove signal handling and timeouts
The timeout option was redundant in that the runtime of check_icmp was always limited by the input parameters and therefore timeout gets removed with this commit to avoid that confusion. The rest of the signal handlings was removed too, since the added complexity does not provide sufficient returns. If check_icmp gets a signal, it now dies like most other programs instead of trying to save some things and return a (arguably wrong) result.
Diffstat (limited to 'plugins-root/check_icmp.c')
-rw-r--r--plugins-root/check_icmp.c18
1 files changed, 1 insertions, 17 deletions
diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c
index 7360b435..55405b8a 100644
--- a/plugins-root/check_icmp.c
+++ b/plugins-root/check_icmp.c
@@ -431,8 +431,7 @@ check_icmp_config_wrapper process_arguments(int argc, char **argv) {
431 } 431 }
432 break; 432 break;
433 case 't': 433 case 't':
434 timeout = (unsigned int)strtoul(optarg, NULL, 0); 434 // WARNING Deprecated since execution time is determined by the other factors
435 // TODO die here and complain about wrong input
436 break; 435 break;
437 case 'H': { 436 case 'H': {
438 add_host_wrapper host_add_result = 437 add_host_wrapper host_add_result =
@@ -895,21 +894,6 @@ int main(int argc, char **argv) {
895 } 894 }
896 } 895 }
897 896
898 struct sigaction sig_action;
899 sig_action.sa_handler = NULL;
900 sig_action.sa_sigaction = check_icmp_timeout_handler;
901 sigfillset(&sig_action.sa_mask);
902 sig_action.sa_flags = SA_NODEFER | SA_RESTART | SA_SIGINFO;
903
904 sigaction(SIGINT, &sig_action, NULL);
905 sigaction(SIGHUP, &sig_action, NULL);
906 sigaction(SIGTERM, &sig_action, NULL);
907 sigaction(SIGALRM, &sig_action, NULL);
908 if (debug) {
909 printf("Setting alarm timeout to %u seconds\n", timeout);
910 }
911 alarm(timeout);
912
913 /* make sure we don't wait any longer than necessary */ 897 /* make sure we don't wait any longer than necessary */
914 struct timeval prog_start; 898 struct timeval prog_start;
915 gettimeofday(&prog_start, NULL); 899 gettimeofday(&prog_start, NULL);