[collectd] [PATCH] collection3: skip host dirs without read access.

Marc Fournier marc.fournier at camptocamp.com
Wed Sep 16 12:17:28 CEST 2009


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 <marc.fournier at camptocamp.com>
---
 contrib/collection3/lib/Collectd/Graph/Common.pm |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/contrib/collection3/lib/Collectd/Graph/Common.pm b/contrib/collection3/lib/Collectd/Graph/Common.pm
index 6019edb..f88c22b 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);
-- 
1.6.3.3




More information about the collectd mailing list