[icinga-checkins] icinga.org: icinga-core/rbartels/cgi: classic-ui: fixed Service Dependencies gets displayed twice in extinfo.cgi #2521

git at icinga.org git at icinga.org
Sat Apr 14 00:23:35 CEST 2012


Module: icinga-core
Branch: rbartels/cgi
Commit: 07675085640910a2912d00c7d7d1502263f844f8
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=07675085640910a2912d00c7d7d1502263f844f8

Author: Ricardo Bartels <ricardo at bitchbrothers.com>
Date:   Fri Apr 13 23:24:22 2012 +0200

classic-ui: fixed Service Dependencies gets displayed twice in extinfo.cgi #2521

refs: #2521

now servicedependencies are only displayed once

---

 cgi/extinfo.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/cgi/extinfo.c b/cgi/extinfo.c
index 454fac7..6bcac22 100644
--- a/cgi/extinfo.c
+++ b/cgi/extinfo.c
@@ -176,6 +176,8 @@ int main(void) {
 	service *temp_service = NULL;
 	servicegroup *temp_servicegroup = NULL;
 	servicedependency *temp_sd = NULL;
+	char *last_sd_svc_desc = "";
+	char *last_sd_hostname = "";
 	hostdependency *temp_hd = NULL;
 
 	mac = get_global_macros();
@@ -515,7 +517,8 @@ int main(void) {
 
 				for (temp_sd = servicedependency_list; temp_sd != NULL; temp_sd = temp_sd->next) {
 
-					if (!strcmp(temp_sd->dependent_service_description, temp_service->description) && !strcmp(temp_sd->dependent_host_name, temp_host->name)) {
+					if (!strcmp(temp_sd->dependent_service_description, temp_service->description) && !strcmp(temp_sd->dependent_host_name, temp_host->name) && \
+					  !(!strcmp(temp_sd->service_description, last_sd_svc_desc) && !strcmp(temp_sd->host_name, last_sd_hostname))) {
 						if (found == TRUE)
 							printf(", ");
 
@@ -523,6 +526,8 @@ int main(void) {
 						printf("&service=%s'>%s on %s</A>\n", url_encode(temp_sd->service_description), html_encode(temp_sd->service_description, FALSE), html_encode(temp_sd->host_name, FALSE));
 						found = TRUE;
 					}
+					last_sd_svc_desc=temp_sd->service_description;
+					last_sd_hostname=temp_sd->host_name;
 				}
 
 				if (found == FALSE)





More information about the icinga-checkins mailing list