From c15797a48b5f133c37e9399546165525eebddc1c Mon Sep 17 00:00:00 2001 From: Charles Manning Date: Thu, 21 May 2015 17:27:01 +1200 Subject: [PATCH] yaffs: Fix yaffs_readdir when dereferencing a symlink If the directory is a symlink then follow the symlink. eg yaffs_mount("/nand/"); yaffs_symlink("x", "/nand/sym"); yaffs_mkdir("/nand/x",0666); After that: yaffs_opendir("/nand/sym/") works, but opendir("/nand/sym") fails because the symlink itself is found. Fix by dereferencing the symlink in yaffs_opendir(). Thanks to Trent Lillehaugen for finding that. Signed-off-by: Charles Manning --- direct/yaffsfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/direct/yaffsfs.c b/direct/yaffsfs.c index dedd76c..cdde7ab 100644 --- a/direct/yaffsfs.c +++ b/direct/yaffsfs.c @@ -3428,6 +3428,7 @@ static yaffs_DIR *yaffsfs_opendir_reldir_no_lock(struct yaffs_obj *reldir, } obj = yaffsfs_FindObject(reldir, dirname, 0, 1, NULL, ¬Dir, &loop); + obj = yaffsfs_FollowLink(obj, 0, &loop); if (!obj && notDir) yaffsfs_SetError(-ENOTDIR); -- 2.30.2