X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=direct%2Fyaffsfs.c;h=7afde717b97655b253e619bd43014cdb19a5337c;hb=1c39c5b648b8aa5d7961d10135fca68eb8069be4;hp=cdde7abe4a549df817287d64390c87c083a78fc9;hpb=c15797a48b5f133c37e9399546165525eebddc1c;p=yaffs2.git diff --git a/direct/yaffsfs.c b/direct/yaffsfs.c index cdde7ab..7afde71 100644 --- a/direct/yaffsfs.c +++ b/direct/yaffsfs.c @@ -747,7 +747,20 @@ static struct yaffs_obj *yaffsfs_FindObject(struct yaffs_obj *relDir, if (dirOut) *dirOut = dir; - if (dir && *name) + /* At this stage we have looked up directory part and have the name part + * in name if there is one. + * + * eg /nand/x/ will give us a name of "" + * /nand/x will give us a name of "x" + * + * Since the name part might be "." or ".." which need to be fixed. + */ + if (dir && (yaffs_strcmp(name, _Y("..")) == 0)) { + dir = dir->parent; + obj = dir; + } else if (dir && (yaffs_strcmp(name, _Y(".")) == 0)) + obj = dir; + else if (dir && *name) obj = yaffs_find_by_name(dir, name); else obj = dir;