[Nagiosplug-checkins] SF.net SVN: nagiosplug:[2085] nagiosplug/trunk

dermoth at users.sourceforge.net dermoth at users.sourceforge.net
Wed Nov 19 06:59:22 CET 2008


Revision: 2085
          http://nagiosplug.svn.sourceforge.net/nagiosplug/?rev=2085&view=rev
Author:   dermoth
Date:     2008-11-19 05:59:22 +0000 (Wed, 19 Nov 2008)

Log Message:
-----------
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.

Modified Paths:
--------------
    nagiosplug/trunk/NEWS
    nagiosplug/trunk/THANKS.in
    nagiosplug/trunk/lib/utils_disk.c
    nagiosplug/trunk/plugins/check_disk.c

Modified: nagiosplug/trunk/NEWS
===================================================================
--- nagiosplug/trunk/NEWS	2008-11-19 04:01:41 UTC (rev 2084)
+++ nagiosplug/trunk/NEWS	2008-11-19 05:59:22 UTC (rev 2085)
@@ -15,6 +15,7 @@
 	Add missing long options for check_nt (for use with extra-opts)
 	check_icmp now reports min and max round trip time perfdata (Steve Rader)
 	Fixed bug where additional headers with redirection caused a segfault (Dieter Van de Walle - 2089159)
+	check_disk: make autofs mount paths specified with -p before we determing the mount list (Erik Welch)
 
 1.4.13 25th Sept 2008
 	Fix Debian bug #460097: check_http --max-age broken (Hilko Bengen)

Modified: nagiosplug/trunk/THANKS.in
===================================================================
--- nagiosplug/trunk/THANKS.in	2008-11-19 04:01:41 UTC (rev 2084)
+++ nagiosplug/trunk/THANKS.in	2008-11-19 05:59:22 UTC (rev 2085)
@@ -243,3 +243,4 @@
 Steve Rader
 Dieter Van de Walle
 Jan Lipphaus
+Erik Welch

Modified: nagiosplug/trunk/lib/utils_disk.c
===================================================================
--- nagiosplug/trunk/lib/utils_disk.c	2008-11-19 04:01:41 UTC (rev 2084)
+++ nagiosplug/trunk/lib/utils_disk.c	2008-11-19 05:59:22 UTC (rev 2085)
@@ -77,19 +77,18 @@
 struct parameter_list *
 np_del_parameter(struct parameter_list *item, struct parameter_list *prev)
 {
-	struct parameter_list *next;
-   	if (item->name_next)
-  		next = item->name_next;
-	else
-	  	next = NULL;
+  struct parameter_list *next;
 
-	
-	free(item);
-	if (prev)
-	  prev->name_next = next;
+  if (item->name_next)
+    next = item->name_next;
+  else
+    next = NULL;
 
-	return next;
+  free(item);
+  if (prev)
+    prev->name_next = next;
 
+  return next;
 }
 
   

Modified: nagiosplug/trunk/plugins/check_disk.c
===================================================================
--- nagiosplug/trunk/plugins/check_disk.c	2008-11-19 04:01:41 UTC (rev 2084)
+++ nagiosplug/trunk/plugins/check_disk.c	2008-11-19 05:59:22 UTC (rev 2085)
@@ -118,9 +118,6 @@
  #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 @@
       }
       se->group = group;
       set_all_thresholds(se);
+
+      /* 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);
-      stat_path(se);
+
       path_selected = TRUE;
       break;
     case 'x':                 /* exclude path or partition */
@@ -757,7 +758,6 @@
     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))) 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Commits mailing list