[Nagios-devel] patch: fix infinite loop in single definition

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

[Nagios-devel] patch: fix infinite loop in single definition

Post by Guest »

--=-49+ZNzQ2nPTja9jqmLZM
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Patch against latest cvs to fix a case when only one
service/servicegroup/hostgroup etc. is defined causing an infinite loop
during the config check.

--
Matthew Kent
http://magoazul.com

--=-49+ZNzQ2nPTja9jqmLZM
Content-Disposition: attachment; filename=nagios-2.0a1-looping.patch
Content-Type: text/x-patch; name=nagios-2.0a1-looping.patch; charset=ANSI_X3.4-1968
Content-Transfer-Encoding: 7bit

diff -u3 -r nagios_orig/common/objects.c nagios/common/objects.c
--- nagios_orig/common/objects.c 2004-10-03 19:21:44.000000000 -0400
+++ nagios/common/objects.c 2004-10-04 23:00:00.000000000 -0400
@@ -838,8 +838,10 @@
timeperiod_list=new_timeperiod;
timeperiod_list_tail=timeperiod_list;
}
- timeperiod_list_tail->next=new_timeperiod;
- timeperiod_list_tail=new_timeperiod;
+ else {
+ timeperiod_list_tail->next=new_timeperiod;
+ timeperiod_list_tail=new_timeperiod;
+ }
#else
/* timeperiods are sorted in reverse for CGIs, so add new items to head of list */
new_timeperiod->next=timeperiod_list;
@@ -1468,8 +1470,10 @@
host_list=new_host;
host_list_tail=host_list;
}
- host_list_tail->next=new_host;
- host_list_tail=new_host;
+ else {
+ host_list_tail->next=new_host;
+ host_list_tail=new_host;
+ }
#else
/* hosts are sorted in reverse for CGIs, so add new items to head of list */
new_host->next=host_list;
@@ -1741,8 +1745,10 @@
hostgroup_list=new_hostgroup;
hostgroup_list_tail=hostgroup_list;
}
- hostgroup_list_tail->next=new_hostgroup;
- hostgroup_list_tail=new_hostgroup;
+ else {
+ hostgroup_list_tail->next=new_hostgroup;
+ hostgroup_list_tail=new_hostgroup;
+ }
#else
/* hostgroups are sorted in reverse for CGIs, so add new items to head of list */
new_hostgroup->next=hostgroup_list;
@@ -1951,8 +1957,10 @@
servicegroup_list=new_servicegroup;
servicegroup_list_tail=servicegroup_list;
}
- servicegroup_list_tail->next=new_servicegroup;
- servicegroup_list_tail=new_servicegroup;
+ else {
+ servicegroup_list_tail->next=new_servicegroup;
+ servicegroup_list_tail=new_servicegroup;
+ }
#else
/* servicegroups are sorted in reverse for CGIs, so add new items to head of list */
new_servicegroup->next=servicegroup_list;
@@ -2389,8 +2397,10 @@
contact_list=new_contact;
contact_list_tail=contact_list;
}
- contact_list_tail->next=new_contact;
- contact_list_tail=new_contact;
+ else {
+ contact_list_tail->next=new_contact;
+ contact_list_tail=new_contact;
+ }
#else
/* contacts are sorted in reverse for CGIs, so add new items to head of list */
new_contact->next=contact_list;
@@ -2650,8 +2660,10 @@
contactgroup_list=new_contactgroup;
contactgroup_list_tail=contactgroup_list;
}
- contactgroup_list_tail->next=new_contactgroup;
- contactgroup_list_tail=new_contactgroup;
+ else {
+ contactgroup_list_tail->next=new_contactgroup;
+ contactgroup_list_tail=new_contactgroup;
+ }
#else
/* contactgroups are sorted in reverse for CGIs, so add new items to head of list */
new_contactgroup->next=contactgroup_list;
@@ -3286,8 +3298,10 @@
service_list=new_service;
service_list_tail=service_list;
}
- service_list_tail->next=new_service;
- service_list_tail=new_service;
+ else {
+ service_list_tail->next=new_service;
+ service_list_tail=new_service;
+ }
#else
/* services are sorted in reverse for CGIs, so add new items to head of list */
new_service->next=service_list;
@@ -3483,8 +3497,10 @@
command_list=new_command;
command_list_tail=command_list;
}
- command_list_tail->next=new_command;
- command_list_tail=new_command;
+ else {
+ command_list_tail->next=new_command;
+ command_list_tail=new_command;
+ }
#else
/* commands are sorted in reverse for CGIs, so add new items to head of list */
new_command->next=command_list;
@@ -3628,8 +3644,10 @@
serviceescalation_list=new_serviceescalation;
serviceescalation_list_tail=serviceescalation_list;
}
- serviceescalation_list_tail->next=new_serviceescalation;
- serviceescalation_list_tail=new_serviceescalation;
+ else {
+ serviceescalation_list_tail->next=new_serviceescalation;
+ serviceescalation_list

...[email truncated]...


This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked