From 53058522125ef86a65c241ad0a5f56df01d55d6a Mon Sep 17 00:00:00 2001 From: Thomas Guyot-Sionnest Date: Wed, 19 Nov 2008 05:59:22 +0000 Subject: 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 --- plugins/check_disk.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'plugins') diff --git a/plugins/check_disk.c b/plugins/check_disk.c index 2f8afa6c..f0950c95 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c @@ -118,9 +118,6 @@ enum #pragma alloca #endif -/* Linked list of mounted filesystems. */ -static struct mount_entry *mount_list; - int process_arguments (int, char **); void print_path (const char *mypath); void set_all_thresholds (struct parameter_list *path); @@ -639,8 +636,12 @@ process_arguments (int argc, char **argv) } se->group = group; set_all_thresholds(se); - np_set_best_match(se, mount_list, exact_match); + + /* With autofs, it is required to stat() the path before populating the mount_list */ stat_path(se); + mount_list = read_file_system_list (0); + np_set_best_match(se, mount_list, exact_match); + path_selected = TRUE; break; case 'x': /* exclude path or partition */ @@ -757,7 +758,6 @@ process_arguments (int argc, char **argv) case 'C': /* add all mount entries to path_select list if no partitions have been explicitly defined using -p */ if (path_selected == FALSE) { - struct mount_entry *me; struct parameter_list *path; for (me = mount_list; me; me = me->me_next) { if (! (path = np_find_parameter(path_select_list, me->me_mountdir))) -- cgit v1.2.3-74-g34f1