From: Marc Fournier Date: Wed, 16 Sep 2009 10:17:28 +0000 (+0200) Subject: contrib/collection3: skip host dirs without read access. X-Git-Tag: collectd-4.7.4~14 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=81207a4725755b4df70c2d329225f118475f0253;p=collectd.git contrib/collection3: skip host dirs without read access. This patch prevents get_files_from_directory() from failing when DataDir contains directories which we don't have access to. An example would be "lost+found" directories, on ext2/ext3 filesystems, which belong to root and have 0700 filemode. Signed-off-by: Marc Fournier Signed-off-by: Florian Forster --- diff --git a/contrib/collection3/lib/Collectd/Graph/Common.pm b/contrib/collection3/lib/Collectd/Graph/Common.pm index 6019edb4..f88c22b5 100644 --- a/contrib/collection3/lib/Collectd/Graph/Common.pm +++ b/contrib/collection3/lib/Collectd/Graph/Common.pm @@ -265,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);