if (error_code < 0)
CRM_DEBUG2("New CIB %p", new_cib); CRM_DEBUG2("Saved CIB %p", saved_cib);   if (error_code < 0) { CRM_DEBUG2("Freeing new CIB %p", new_cib);
activateCibXml(xmlNodePtr new_cib){	int error_code = 0;	xmlNodePtr saved_cib = get_the_CIB();	FNIN();		if (initializeCib(new_cib) == TRUE) {		int res = moveFile(CIB_FILENAME, CIB_BACKUP, FALSE, NULL);			if (res  < 0) {			cl_log(LOG_INFO,			       "Could not make backup of the current Cib "			       "(code: %d)... aborting update.", res);			error_code = -1;		} else {			// modify the timestamp			set_node_tstamp(new_cib);	    			cl_log(LOG_INFO,			       "Writing CIB out to %s",			       CIB_FILENAME);	    			if (new_cib->doc == NULL) {				cl_log(LOG_INFO,				       "Writing of a node tree with a NULL "				       "document will fail, creating a new "				       "back link.");				xmlDocPtr foo = xmlNewDoc("1.0");				xmlDocSetRootElement(foo, new_cib);				xmlSetTreeDoc(new_cib,foo);			}	    	    			/* save it.			 * set arg 3 to 0 to disable line breaks,1 to enable			 * res == num bytes saved			 */			res = xmlSaveFormatFile(CIB_FILENAME,						new_cib->doc,						0);						/* for some reason, reading back after saving with			 * line-breaks doesnt go real well 			 */			cl_log(LOG_INFO,			       "Saved %d bytes to the Cib as XML",			       res);	    			if (res < 0) {				// assume 0 is good				if (moveFile(CIB_BACKUP,					     CIB_FILENAME,					     FALSE,					     NULL) < -1) {					cl_log(LOG_CRIT,					       "Could not restore the "					       "backup of the current Cib "					       "(code: %d)... panic!",					       res);					error_code = -2;					// should probably exit here 				}				else if (initializeCib(saved_cib) == FALSE){					// oh we are so dead 					cl_log(LOG_CRIT,					       "Could not re-initialize "					       "with the old CIB.  "					       "Everything is about to go "					       "pear shaped");					error_code = -3;				} else {					cl_log(LOG_CRIT,					       "Update of Cib failed "					       "(code: %d)... reverted to "					       "last known valid version",					       res);										error_code = -4;				}			}		}	}	else	{		cl_log(LOG_INFO, "Ignoring invalid or NULL Cib");		error_code = -5;	}	// Make sure memory is cleaned up appropriately	if (error_code < 0)		free_xml(new_cib);	else		free_xml(saved_cib);    	FNRET(error_code);    }