Просмотр исходного кода

Merge pull request #467 from Madlohe/check_disk-timeout

check_disk: fix missing timeout handler
Sebastian Wolf 6 лет назад
Родитель
Сommit
d67f7704fb
2 измененных файлов с 7 добавлено и 0 удалено
  1. 1 0
      NEWS
  2. 6 0
      plugins/check_disk.c

+ 1 - 0
NEWS

@@ -37,6 +37,7 @@ This file documents the major additions and syntax changes between releases.
 	build: fix configure.ac for FreeBSD SWAPFORMAT
 	build: Fix rpmbuild errors (Josh Coughlan)
 	check_disk: autofs being mounted despite '-l'. Fixed, and also excluded some system "fake" mountpoints
+	check_disk: Add missing timeout logic
 	check_dns: Fix for Bind 9.11.x AAAA records being reported with A record format (Troy Lea)
 	check_dns: reverse (PTR) check is now case insensitive
 	check_file_age: For multiple files, use the "worst" status instead of the "last" one

+ 6 - 0
plugins/check_disk.c

@@ -260,6 +260,12 @@ main (int argc, char **argv)
 
   verbose_machine_output = (verbose >= 3 && !human_output);
 
+  /* Set signal handling and alarm timeout */
+  if (signal (SIGALRM, timeout_alarm_handler) == SIG_ERR) {
+    die (STATE_UNKNOWN, _("Cannot catch SIGALRM"));
+  }
+  (void) alarm ((unsigned) timeout_interval);
+
   /* If a list of paths has not been selected, find entire
      mount list and create list of paths
    */