From 6b672deb68a0bb37f6c79da37cc7ea636ee12ae4 Mon Sep 17 00:00:00 2001 From: Junichi Satoh Date: Sun, 25 Sep 2016 13:03:02 +0900 Subject: [PATCH] Added default value (unknown) to $OS_VERSION to avoid undefined value when OS type is not detected. And added $OS_VERSION support for FreeBSD. (Cherry picked from commit 2b5368e8b5822fb128341cab17eaac6a902961ca) --- pandora_server/lib/PandoraFMS/Tools.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pandora_server/lib/PandoraFMS/Tools.pm b/pandora_server/lib/PandoraFMS/Tools.pm index c8610ee893..23352c298b 100755 --- a/pandora_server/lib/PandoraFMS/Tools.pm +++ b/pandora_server/lib/PandoraFMS/Tools.pm @@ -136,7 +136,7 @@ use constant FIRED_ALERT => 1; # Set OS, OS version and /dev/null our $OS = $^O; -our $OS_VERSION; +our $OS_VERSION = "unknown"; our $DEVNULL = '/dev/null'; if ($OS eq 'linux') { $OS_VERSION = `lsb_release -sd 2>/dev/null`; @@ -146,6 +146,8 @@ if ($OS eq 'linux') { $OS = "windows"; $OS_VERSION = `ver`; $DEVNULL = '/Nul'; +} elsif ($OS eq 'freebsd') { + $OS_VERSION = `uname -r`; } chomp($OS_VERSION);