2013-05-10 Ramon Novoa <rnovoa@artica.es>

* lib/PandoraFMS/Tools.pm: Check that inet_aton does not return undef.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8118 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Ramon Novoa 2013-05-10 11:19:02 +00:00
parent 2f31062b25
commit 3d656eb704
2 changed files with 8 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2013-05-10 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/Tools.pm: Check that inet_aton does not return undef.
2013-05-07 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/Tools.pm: Added a function to resolve hostnames.

View File

@ -1171,7 +1171,10 @@ sub cron_get_closest_in_range ($$) {
sub resolve_hostname ($) {
my ($hostname) = @_;
return inet_ntoa(inet_aton($hostname));
$resolved_hostname = inet_aton($hostname);
return $hostname if (! defined ($resolved_hostname));
return inet_ntoa($resolved_hostname);
}
# End of function declaration