Added default value (unknown) to $OS_VERSION to avoid undefined value when

OS type is not detected. And added $OS_VERSION support for FreeBSD.
This commit is contained in:
Junichi Satoh 2016-09-25 13:03:02 +09:00
parent cf4255bf21
commit 2b5368e8b5
1 changed files with 3 additions and 1 deletions

View File

@ -126,7 +126,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`;
@ -136,6 +136,8 @@ if ($OS eq 'linux') {
$OS = "windows";
$OS_VERSION = `ver`;
$DEVNULL = '/Nul';
} elsif ($OS eq 'freebsd') {
$OS_VERSION = `uname -r`;
}
chomp($OS_VERSION);