From: Benjamin Pineau Date: Sat, 5 Jul 2008 08:45:09 +0000 (+0200) Subject: qmail plugin: Don't recurse into ".", ".." and other directories beginning with a... X-Git-Tag: collectd-4.5.0~103 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=9e68a7714e1e7fba52d73de7117eb5338077a0d7;p=collectd.git qmail plugin: Don't recurse into ".", ".." and other directories beginning with a dot. Also use PATH_MAX instead of 4096. --- diff --git a/src/qmail.c b/src/qmail.c index 1a8e2bd9..74386c38 100644 --- a/src/qmail.c +++ b/src/qmail.c @@ -81,9 +81,12 @@ static int count_files_in_subtree (const char *path, int depth) count = 0; while ((de = readdir (dh)) != NULL) { - char abs_path[4096]; + char abs_path[PATH_MAX]; struct stat statbuf; + if (de->d_name[0] == '.') + continue; + ssnprintf (abs_path, sizeof (abs_path), "%s/%s", path, de->d_name); status = lstat (abs_path, &statbuf);