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

dermoth at users.sourceforge.net dermoth at users.sourceforge.net
Wed Feb 13 12:05:45 CET 2008


Revision: 1930
          http://nagiosplug.svn.sourceforge.net/nagiosplug/?rev=1930&view=rev
Author:   dermoth
Date:     2008-02-13 03:05:44 -0800 (Wed, 13 Feb 2008)

Log Message:
-----------
set_thresholds now let the user free the thresolds. (P.S.: When you set twice the thresholds for a path in check disk (like using -C followed by -p ) it overrides them. All new elements are created with np_add_parameter which initialises the thresholds to NULL.)

Modified Paths:
--------------
    nagiosplug/trunk/lib/utils_base.c
    nagiosplug/trunk/plugins/check_disk.c

Modified: nagiosplug/trunk/lib/utils_base.c
===================================================================
--- nagiosplug/trunk/lib/utils_base.c	2008-02-13 04:18:36 UTC (rev 1929)
+++ nagiosplug/trunk/lib/utils_base.c	2008-02-13 11:05:44 UTC (rev 1930)
@@ -120,10 +120,6 @@
 		}
 	}
 
-	if (*my_thresholds > 0) {	/* Not sure why, but sometimes could be -1 */
-		/* printf("Freeing here: %d\n", *my_thresholds); */
-		free(*my_thresholds);
-	}
 	*my_thresholds = temp_thresholds;
 
 	return 0;

Modified: nagiosplug/trunk/plugins/check_disk.c
===================================================================
--- nagiosplug/trunk/plugins/check_disk.c	2008-02-13 04:18:36 UTC (rev 1929)
+++ nagiosplug/trunk/plugins/check_disk.c	2008-02-13 11:05:44 UTC (rev 1930)
@@ -688,7 +688,7 @@
    	        printf("ignoring %s matching regex\n", temp_list->name);
 
               temp_list = np_del_parameter(temp_list, previous);
-              /* pointer to first element needs to be uüdated if first item gets deleted */
+              /* pointer to first element needs to be updated if first item gets deleted */
               if (previous == NULL)
                 path_select_list = temp_list;
           } else {
@@ -828,11 +828,17 @@
 void
 set_all_thresholds (struct parameter_list *path) 
 {
+		if (path->freespace_units != NULL) free(path->freespace_units);
     set_thresholds(&path->freespace_units, warn_freespace_units, crit_freespace_units);
+		if (path->freespace_percent != NULL) free (path->freespace_percent);
     set_thresholds(&path->freespace_percent, warn_freespace_percent, crit_freespace_percent);
+		if (path->usedspace_units != NULL) free (path->usedspace_units);
     set_thresholds(&path->usedspace_units, warn_usedspace_units, crit_usedspace_units);
+		if (path->usedspace_percent != NULL) free (path->usedspace_percent);
     set_thresholds(&path->usedspace_percent, warn_usedspace_percent, crit_usedspace_percent);
+		if (path->usedinodes_percent != NULL) free (path->usedinodes_percent);
     set_thresholds(&path->usedinodes_percent, warn_usedinodes_percent, crit_usedinodes_percent);
+		if (path->freeinodes_percent != NULL) free (path->freeinodes_percent);
     set_thresholds(&path->freeinodes_percent, warn_freeinodes_percent, crit_freeinodes_percent);
 }
 


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