summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Guyot-Sionnest <dermoth@users.sourceforge.net>2008-11-19 05:59:22 (GMT)
committerThomas Guyot-Sionnest <dermoth@users.sourceforge.net>2008-11-19 05:59:22 (GMT)
commit53058522125ef86a65c241ad0a5f56df01d55d6a (patch)
treef9a2b4a51626b5660bf867c5ffd9388bd3e90638
parente77ddaf6db1621001634fb5602ea42a59cf0660c (diff)
downloadmonitoring-plugins-53058522125ef86a65c241ad0a5f56df01d55d6a.tar.gz
check_disk: rerpopulate the mount list after doing a stat() on paths specified with -p for better automount support.
NB: There's a memory leak here - properly freeing the mount list would invlove much more work - there's many other places where leaks can happen so it should be a project on its own. git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2085 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r--NEWS1
-rw-r--r--THANKS.in1
-rw-r--r--lib/utils_disk.c19
-rw-r--r--plugins/check_disk.c10
4 files changed, 16 insertions, 15 deletions
diff --git a/NEWS b/NEWS
index 438ab67..5149f91 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,7 @@ This file documents the major additions and syntax changes between releases.
15 Add missing long options for check_nt (for use with extra-opts) 15 Add missing long options for check_nt (for use with extra-opts)
16 check_icmp now reports min and max round trip time perfdata (Steve Rader) 16 check_icmp now reports min and max round trip time perfdata (Steve Rader)
17 Fixed bug where additional headers with redirection caused a segfault (Dieter Van de Walle - 2089159) 17 Fixed bug where additional headers with redirection caused a segfault (Dieter Van de Walle - 2089159)
18 check_disk: make autofs mount paths specified with -p before we determing the mount list (Erik Welch)
18 19
191.4.13 25th Sept 2008 201.4.13 25th Sept 2008
20 Fix Debian bug #460097: check_http --max-age broken (Hilko Bengen) 21 Fix Debian bug #460097: check_http --max-age broken (Hilko Bengen)
diff --git a/THANKS.in b/THANKS.in
index 072cff0..7784be9 100644
--- a/THANKS.in
+++ b/THANKS.in
@@ -243,3 +243,4 @@ Olivier 'Babar' Raginel
243Steve Rader 243Steve Rader
244Dieter Van de Walle 244Dieter Van de Walle
245Jan Lipphaus 245Jan Lipphaus
246Erik Welch
diff --git a/lib/utils_disk.c b/lib/utils_disk.c
index e22d668..3ce4d47 100644
--- a/lib/utils_disk.c
+++ b/lib/utils_disk.c
@@ -77,19 +77,18 @@ np_add_parameter(struct parameter_list **list, const char *name)
77struct parameter_list * 77struct parameter_list *
78np_del_parameter(struct parameter_list *item, struct parameter_list *prev) 78np_del_parameter(struct parameter_list *item, struct parameter_list *prev)
79{ 79{
80 struct parameter_list *next; 80 struct parameter_list *next;
81 if (item->name_next)
82 next = item->name_next;
83 else
84 next = NULL;
85 81
86 82 if (item->name_next)
87 free(item); 83 next = item->name_next;
88 if (prev) 84 else
89 prev->name_next = next; 85 next = NULL;
90 86
91 return next; 87 free(item);
88 if (prev)
89 prev->name_next = next;
92 90
91 return next;
93} 92}
94 93
95 94
diff --git a/plugins/check_disk.c b/plugins/check_disk.c
index 2f8afa6..f0950c9 100644
--- a/plugins/check_disk.c
+++ b/plugins/check_disk.c
@@ -118,9 +118,6 @@ enum
118 #pragma alloca 118 #pragma alloca
119#endif 119#endif
120 120
121/* Linked list of mounted filesystems. */
122static struct mount_entry *mount_list;
123
124int process_arguments (int, char **); 121int process_arguments (int, char **);
125void print_path (const char *mypath); 122void print_path (const char *mypath);
126void set_all_thresholds (struct parameter_list *path); 123void set_all_thresholds (struct parameter_list *path);
@@ -639,8 +636,12 @@ process_arguments (int argc, char **argv)
639 } 636 }
640 se->group = group; 637 se->group = group;
641 set_all_thresholds(se); 638 set_all_thresholds(se);
642 np_set_best_match(se, mount_list, exact_match); 639
640 /* With autofs, it is required to stat() the path before populating the mount_list */
643 stat_path(se); 641 stat_path(se);
642 mount_list = read_file_system_list (0);
643 np_set_best_match(se, mount_list, exact_match);
644
644 path_selected = TRUE; 645 path_selected = TRUE;
645 break; 646 break;
646 case 'x': /* exclude path or partition */ 647 case 'x': /* exclude path or partition */
@@ -757,7 +758,6 @@ process_arguments (int argc, char **argv)
757 case 'C': 758 case 'C':
758 /* add all mount entries to path_select list if no partitions have been explicitly defined using -p */ 759 /* add all mount entries to path_select list if no partitions have been explicitly defined using -p */
759 if (path_selected == FALSE) { 760 if (path_selected == FALSE) {
760 struct mount_entry *me;
761 struct parameter_list *path; 761 struct parameter_list *path;
762 for (me = mount_list; me; me = me->me_next) { 762 for (me = mount_list; me; me = me->me_next) {
763 if (! (path = np_find_parameter(path_select_list, me->me_mountdir))) 763 if (! (path = np_find_parameter(path_select_list, me->me_mountdir)))