From 52543e770fb2e416365998d02c4b2fc2a53dbb8e Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Mon, 9 Jan 2012 19:01:50 +0100 Subject: [PATCH] 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 --- src/common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) { -- 2.11.0