[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [hobbit] Todays snapshot (23/5) infocolumn still does not work



On Tue, May 23, 2006 at 06:08:04AM +0200, lars ebeling wrote:
> #0  0x00012198 in criteriamatch (alert=0x7f7e66d8, crit=0x400070f8,             
>     rulecrit=0x0, anymatch=0x0, nexttime=0x0) at loadalerts.c:798               
> 798             if (crit && alert->groups && (*(alert->groups)) && (crit->groups

Oops... Try this, I'm sure it fixes it. 


Regards,
Henrik

--- web/hobbitsvc-info.c	2006/05/19 12:02:55	1.103
+++ web/hobbitsvc-info.c	2006/05/23 05:40:12
@@ -170,7 +170,7 @@
 static void generate_hobbit_alertinfo(char *hostname, strbuffer_t *buf)
 {
 	namelist_t *hi = hostinfo(hostname);
-	activealerts_t alert;
+	activealerts_t *alert;
 	char l[1024];
 	int i, rcount;
 
@@ -178,23 +178,20 @@
 	addtobuffer(buf, l);
 	addtobuffer(buf, "<tr><th>Service</th><th>Recipient</th><th>1st Delay</th><th>Stop after</th><th>Repeat</th><th>Time of Day</th><th>Colors</th></tr>\n");
 
-	alert.hostname = hostname;
-	alert.location = (hi ? hi->page->pagepath : "");
-	strcpy(alert.ip, "127.0.0.1");
-	alert.color = COL_RED;
-	alert.pagemessage = "";
-	alert.ackmessage = NULL;
-	alert.eventstart = 0;
-	alert.nextalerttime = 0;
-	alert.state = A_PAGING;
-	alert.cookie = 12345;
-	alert.next = NULL;
+	alert = calloc(1, sizeof(activealerts_t));
+	alert->hostname = hostname;
+	alert->location = (hi ? hi->page->pagepath : "");
+	strcpy(alert->ip, "127.0.0.1");
+	alert->color = COL_RED;
+	alert->pagemessage = "";
+	alert->state = A_PAGING;
+	alert->cookie = 12345;
 	rcount = 0;
 
 	alert_printmode(1);
 	for (i = 0; (i < testcount); i++) {
-		alert.testname = tnames[i].name;
-		if (have_recipient(&alert, NULL)) { rcount++; print_alert_recipients(&alert, buf); }
+		alert->testname = tnames[i].name;
+		if (have_recipient(alert, NULL)) { rcount++; print_alert_recipients(alert, buf); }
 	}
 
 	if (rcount == 0) {
@@ -202,6 +199,8 @@
 		addtobuffer(buf, "<tr><td colspan=9 align=center><b><i>No alerts defined</i></b></td></tr>\n");
 	}
 	addtobuffer(buf, "</table>\n");
+
+	xfree(alert);
 }