X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=contrib%2Fcollection3%2Flib%2FCollectd%2FGraph%2FCommon.pm;h=f88c22b5420aeb9e961c208dc688b6f9f463f8e0;hb=e21d0408e4e4001b8c66bb1ea7d41b890100d0f5;hp=b445c8e45e9736feb2082eb34f147c79d9e297a6;hpb=e8999694aac7184ac4eea29564a2892f188c4171;p=collectd.git diff --git a/contrib/collection3/lib/Collectd/Graph/Common.pm b/contrib/collection3/lib/Collectd/Graph/Common.pm index b445c8e4..f88c22b5 100644 --- a/contrib/collection3/lib/Collectd/Graph/Common.pm +++ b/contrib/collection3/lib/Collectd/Graph/Common.pm @@ -216,6 +216,7 @@ sub get_files_from_directory my $recursive = @_ ? shift : 0; my $dh; my @directories = (); + my @files = (); my $ret = []; opendir ($dh, $dir) or die ("opendir ($dir): $!"); @@ -231,15 +232,13 @@ sub get_files_from_directory } elsif (-f $entry) { - my $ident = filename_to_ident ($entry); - if ($ident) - { - push (@$ret, $ident); - } + push (@files, $entry); } } closedir ($dh); + push (@$ret, map { filename_to_ident ($_) } sort (@files)); + if ($recursive > 0) { for (@directories) @@ -247,7 +246,7 @@ sub get_files_from_directory my $temp = get_files_from_directory ($_, $recursive - 1); if ($temp && @$temp) { - push (@$ret, @$temp); + push (@$ret, @$temp); } } } @@ -266,6 +265,7 @@ sub get_all_hosts { next if ($entry =~ m/^\./); next if (!-d "$data_dir/$entry"); + next if (!-r "$data_dir/$entry" or !-x "$data_dir/$entry"); push (@ret, sanitize_hostname ($entry)); } closedir ($dh);