From f004a0a9804e57ee43820d63e0a07d5ea9119050 Mon Sep 17 00:00:00 2001 From: David van Moolenbroek Date: Wed, 2 May 2012 17:39:58 +0200 Subject: [PATCH] test43: fix dangling-symlink case --- test/test43.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/test43.c b/test/test43.c index 91d78d5ec..354af2a14 100644 --- a/test/test43.c +++ b/test/test43.c @@ -68,9 +68,11 @@ static int check_path_components(const char *path) /* * is this a valid path segment? if not, return errno. * one exception: the last path component need not exist + * - unless it is actually a dangling symlink */ if (stat(buffer, &statbuf) < 0 && - (*path || errno != ENOENT)) + (*path || errno != ENOENT || + lstat(buffer, &statbuf) == 0)) return errno; } @@ -200,7 +202,8 @@ static void check_realpath_recurse(const char *path, int depth) /* don't bother with non-directories. Due to timeouts in drivers we * might not get expected results and takes way too long */ if (stat(path, &st) != 0) { - ERR; + /* dangling symlinks may cause legitimate failures here */ + if (lstat(path, &st) != 0) ERR; return; } if (!S_ISDIR(st.st_mode))