From: Jonathan Nieder Date: Mon, 9 Jan 2012 18:01:50 +0000 (+0100) Subject: common: check_create_dir(): Support symlinks as well. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=70d546a837192a4f820f67946877dea7353c0eb2;p=collectd.git common: check_create_dir(): Support symlinks as well. Previously, the following situation would cause an endless look (as reported by Michael Prokop in Debian bug #619123): the (CSV or RRD) datadir is a symlink pointing to a non-existent target. With this patch applied, check_create_dir() fails with " exists but is not a directory". Signed-off-by: Sebastian Harl --- diff --git a/src/common.c b/src/common.c index d2a1b362..530f7330 100644 --- a/src/common.c +++ b/src/common.c @@ -542,7 +542,8 @@ int check_create_dir (const char *file_orig) } while (42) { - if (stat (dir, &statbuf) == -1) + if ((stat (dir, &statbuf) == -1) + && (lstat (dir, &statbuf) == -1)) { if (errno == ENOENT) {