/* initiate configuration reload */ void main_loop_reload_config_initiate(void) { if (main_loop_is_terminating()) return; service_management_publish_status("Reloading configuration"); if (main_loop_new_config) { /* This block is entered only if this function is reentered before * main_loop_reload_config_apply() would be called. In that case we * drop the previously parsed configuration and start over again to * ensure that the contents of the running configuration matches the * contents of the file at the time the SIGHUP signal was received. */ cfg_free(main_loop_new_config); main_loop_new_config = NULL; } main_loop_old_config = current_configuration; app_pre_config_loaded(); main_loop_new_config = cfg_new(0); if (!cfg_read_config(main_loop_new_config, resolvedConfigurablePaths.cfgfilename, FALSE, NULL)) { cfg_free(main_loop_new_config); main_loop_new_config = NULL; main_loop_old_config = NULL; msg_error("Error parsing configuration", evt_tag_str(EVT_TAG_FILENAME, resolvedConfigurablePaths.cfgfilename)); service_management_publish_status("Error parsing new configuration, using the old config"); return; } main_loop_worker_sync_call(main_loop_reload_config_apply); }
static int init(void) { if (initialised) cfg_clean_config(); report(LOG_NOTICE, "Reading config"); if (!session.cfgfile) { report(LOG_ERR, "no config file specified"); tac_exit(1); } /* read the config file */ if (cfg_read_config(session.cfgfile)) { report(LOG_ERR, "Parsing %s", session.cfgfile); tac_exit(1); } if (session.acctfile == NULL && !(session.flags & SESS_FLAG_ACCTSYSL)) session.acctfile = tac_strdup(TACPLUS_ACCTFILE); initialised++; reinitialize = 0; report(LOG_NOTICE, "Version %s Initialized %d", version, initialised); return 0; }
static gboolean _init_filters_from_file(AddContextualDataFilterSelector *self) { self->cfg = cfg_new_snippet(); if (!cfg_read_config(self->cfg, self->filters_path, FALSE, NULL)) { cfg_free(self->cfg); self->cfg = NULL; msg_error("Error parsing filters of rule engine", evt_tag_str(EVT_TAG_FILENAME, self->filters_path)); return FALSE; } return TRUE; }
/* * Returns: exit code to be returned to the calling process, 0 on success. */ int main_loop_read_and_init_config(void) { current_configuration = cfg_new(0); if (!cfg_read_config(current_configuration, resolvedConfigurablePaths.cfgfilename, syntax_only, preprocess_into)) { return 1; } if (syntax_only || preprocess_into) { return 0; } if (!main_loop_initialize_state(current_configuration, resolvedConfigurablePaths.persist_file)) { return 2; } return 0; }