Merge branch 'ent-10777-encolamiento-ficheros-xml-con-tildes' into 'develop'

Changed xml agent filename to hash to avoid special chars problems

See merge request artica/pandorafms!5773
This commit is contained in:
Diego Muñoz-Reja 2023-04-27 15:51:14 +00:00
commit ddda7a71bf
2 changed files with 2 additions and 2 deletions

View File

@ -2018,7 +2018,7 @@ sub pandora_agent_run () {
$Xml = $xml_header . $Xml . "</agent_data>";
# Save XML data file
my $temp_file = $Conf{'temporal'} . '/' . $Conf{'agent_name'} . '.' . time () . '.data';
my $temp_file = $Conf{'temporal'} . '/' . md5($Conf{'agent_name'}) . '.' . time () . '.data';
if (-l $temp_file && !unlink($temp_file)) {
error ("File '$temp_file' already exists as a symlink and could not be removed: $!");
return 1;

View File

@ -4377,7 +4377,7 @@ while (1) {
$Xml = $xml_header . $Xml . "</agent_data>";
# Save XML data file
my $temp_file = $Conf{'temporal'} . '/' . $Conf{'agent_name'} . '.' . time () . '.data';
my $temp_file = $Conf{'temporal'} . '/' . md5($Conf{'agent_name'}) . '.' . time () . '.data';
error ("File '$temp_file' already exists as a symlink and could not be removed: $!") if (-l $temp_file && !unlink($temp_file));
open (TEMP_FILE, "> $temp_file") || error ("Could not write XML data file: $!");
print TEMP_FILE $Xml;