From: David van Moolenbroek Date: Wed, 2 May 2012 15:39:58 +0000 (+0200) Subject: test43: fix dangling-symlink case X-Git-Tag: v3.2.1~561 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/style.css?a=commitdiff_plain;h=f004a0a9804e57ee43820d63e0a07d5ea9119050;p=minix.git test43: fix dangling-symlink case --- 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))