diff --git a/pandora_agents/ChangeLog b/pandora_agents/ChangeLog index 8554014a32..f27a7b15ec 100644 --- a/pandora_agents/ChangeLog +++ b/pandora_agents/ChangeLog @@ -1,3 +1,7 @@ +2011-09-06 Vanessa Gil + + * win32/pandora_agent_conf.php: Fixed error creating broker agent. + 2011-09-05 Ramon Novoa * unix/plugins/inventory: Added support for hwinfo. diff --git a/pandora_agents/win32/pandora_agent_conf.cc b/pandora_agents/win32/pandora_agent_conf.cc index 560141c36c..f09b4e01bf 100644 --- a/pandora_agents/win32/pandora_agent_conf.cc +++ b/pandora_agents/win32/pandora_agent_conf.cc @@ -109,7 +109,7 @@ Pandora::Pandora_Agent_Conf::parseFile(string path_file, Collection *aux){ void writeBrokerConf(string path_broker, string filename, string name_broker){ ifstream file_conf (filename.c_str ()); - ofstream file_broker (path_broker.c_str ()); + ofstream file_broker ((Pandora::getPandoraInstallDir ()+path_broker).c_str ()); string buffer; string comp; unsigned int pos; @@ -199,12 +199,13 @@ Pandora::Pandora_Agent_Conf::setFile (string *all_conf){ all_conf[position] = Pandora::getPandoraInstallDir () + path_broker; position += 1; - ifstream file_br (path_broker.c_str ()); + ifstream file_br ((Pandora::getPandoraInstallDir () + path_broker).c_str ()); /* Check if already exists the configuration file*/ - if (!file_br){ - file_br.close(); + if (!file_br.is_open()){ writeBrokerConf(path_broker, filename, name_broker); - } + } else { + file_br.close(); + } } /*Check if is a collection*/