diff --git a/pandora_agents/ChangeLog b/pandora_agents/ChangeLog index 58fcc1f6a8..e58777fad2 100644 --- a/pandora_agents/ChangeLog +++ b/pandora_agents/ChangeLog @@ -1,3 +1,8 @@ +2011-09-16 Dario Rodriguez + + * win32/pandora_agent_conf.cc: Fixed a problem generating broker conf + files with wrong agent names. + 2011-09-15 Vanessa Gil * win32/pandora_windows_service.cc: Fixed problem sending xml file. diff --git a/pandora_agents/win32/pandora_agent_conf.cc b/pandora_agents/win32/pandora_agent_conf.cc index f09b4e01bf..d0a76da4e0 100644 --- a/pandora_agents/win32/pandora_agent_conf.cc +++ b/pandora_agents/win32/pandora_agent_conf.cc @@ -113,7 +113,9 @@ writeBrokerConf(string path_broker, string filename, string name_broker){ string buffer; string comp; unsigned int pos; - + int i; + int ok; + /* Read and set the file */ while (!file_conf.eof ()) { /* Set the value from each line */ @@ -121,11 +123,19 @@ writeBrokerConf(string path_broker, string filename, string name_broker){ pos = buffer.find("agent_name"); if (pos != string::npos){ - comp = buffer.substr (0,12); - if (comp == "# agent_name"){ + ok = 1; + + for(i=0; i < pos; i++) { + + if(buffer[i] != ' ' && buffer[i] != '\t' && buffer[i] != '#') { + ok = 0; + } + } + + if (ok) { buffer = "agent_name "+name_broker+"\n"; - } - } + } + } pos = buffer.find("broker_agent"); if (pos != string::npos){