Skip to content

Commit

Permalink
avoid error messages if 'include_dir' option is not present
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaku committed Mar 18, 2014
1 parent 6871a49 commit 512dc64
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions monitorix
Expand Up @@ -442,7 +442,7 @@ if($options{d}) {
}

# load additional configuration files
if(opendir(DIR, $config{include_dir})) {
if($config{include_dir} && opendir(DIR, $config{include_dir})) {
my @files = grep { !/^[.]/ } readdir(DIR);
close(DIR);
foreach my $c (sort @files) {
Expand Down Expand Up @@ -488,7 +488,8 @@ if(opendir(DIR, $config{include_dir})) {
@config{keys %config_inc} = values %config_inc;
}
} else {
logger("Can't read directory '$config{include_dir}'. $!");
logger("Can't read directory '$config{include_dir}'. $!")
if $config{include_dir};
}

# save the path of the configuration file
Expand Down
2 changes: 1 addition & 1 deletion monitorix.cgi
Expand Up @@ -217,7 +217,7 @@ my $conf = new Config::General(
%config = $conf->getall;

# load additional configuration files
if(opendir(DIR, $config{include_dir})) {
if($config{include_dir} && opendir(DIR, $config{include_dir})) {
my @files = grep { !/^[.]/ } readdir(DIR);
close(DIR);
foreach my $c (sort @files) {
Expand Down

0 comments on commit 512dc64

Please sign in to comment.