char *filename;
char *filename = NULL;
admin_msg_callback(IPC_Channel * server, void *private_data){	int lpc = 0;	IPC_Message *msg = NULL;	ha_msg_input_t *new_input = NULL;	gboolean hack_return_good = TRUE;	static int received_responses = 0;	char *filename;	int filename_len = 0;	const char *result = NULL;	g_source_remove(message_timer_id);	while (server->ch_status != IPC_DISCONNECT	       && server->ops->is_message_pending(server) == TRUE) {		if(new_input != NULL) {			delete_ha_msg_input(new_input);		}				if (server->ops->recv(server, &msg) != IPC_OK) {			perror("Receive failure:");			return !hack_return_good;		}		if (msg == NULL) {			crm_trace("No message this time");			continue;		}		lpc++;		new_input = new_ipc_msg_input(msg);		msg->msg_done(msg);		crm_log_message(LOG_MSG, new_input->msg);				if (new_input->xml == NULL) {			crm_info(			       "XML in IPC message was not valid... "			       "discarding.");			continue;		} else if (validate_crm_message(				   new_input->msg, crm_system_name, admin_uuid,				   XML_ATTR_RESPONSE) == FALSE) {			crm_info(			       "Message was not a CRM response. Discarding.");			continue;		}		result = cl_get_string(new_input->msg, XML_ATTR_RESULT);		if(result == NULL || strcmp(result, "ok") == 0) {			result = "pass";		} else {			result = "fail";		}				received_responses++;		if(DO_HEALTH) {			const char *state = crm_element_value(				new_input->xml, "crmd_state");			printf("Status of %s@%s: %s (%s)\n",			       crm_element_value(new_input->xml,XML_PING_ATTR_SYSFROM),			       cl_get_string(new_input->msg, F_CRM_HOST_FROM),			       state,			       crm_element_value(new_input->xml,XML_PING_ATTR_STATUS));						if(BE_SILENT && state != NULL) {				fprintf(stderr, "%s\n", state);			}					} else if(DO_WHOIS_DC) {			const char *dc = cl_get_string(				new_input->msg, F_CRM_HOST_FROM);						printf("Designated Controller is: %s\n", dc);			if(BE_SILENT && dc != NULL) {				fprintf(stderr, "%s\n", dc);			}		}				if (this_msg_reference != NULL) {			/* in testing mode... */			/* 31 = "test-_.xml" + an_int_as_string + '\0' */			filename_len = 31 + strlen(this_msg_reference);			crm_malloc0(filename, sizeof(char) * filename_len);			if(filename != NULL) {				sprintf(filename, "%s-%s_%d.xml",					result, this_msg_reference,					received_responses);								filename[filename_len - 1] = '\0';				if (0 > write_xml_file(new_input->xml, filename)) {					crm_crit("Could not save response to"						 " %s", filename);				}			}		}	}	if (server->ch_status == IPC_DISCONNECT) {		crm_verbose("admin_msg_callback: received HUP");		return !hack_return_good;	}	if (received_responses >= expected_responses) {		crm_verbose(		       "Recieved expected number (%d) of messages from Heartbeat."		       "  Exiting normally.", expected_responses);		g_main_quit(mainloop);		return !hack_return_good;	}	message_timer_id = Gmain_timeout_add(		message_timeout_ms, admin_message_timeout, NULL);			return hack_return_good;}