X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=direct%2Fyaffsfs.c;h=952ffacdbdf259901c5f3608b233210e03bf7bcc;hb=6f398a8b6eab8d0c61010c144f01d706dc0dad8b;hp=cdde7abe4a549df817287d64390c87c083a78fc9;hpb=c15797a48b5f133c37e9399546165525eebddc1c;p=yaffs2.git diff --git a/direct/yaffsfs.c b/direct/yaffsfs.c index cdde7ab..952ffac 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; @@ -840,7 +853,7 @@ int yaffs_open_sharing_reldir(struct yaffs_obj *reldir, const YCHAR *path, oflag &= ~(O_EXCL); /* O_TRUNC has no meaning if (O_CREAT | O_EXCL) is specified */ - if ((oflag & O_CREAT) & (oflag & O_EXCL)) + if ((oflag & O_CREAT) && (oflag & O_EXCL)) oflag &= ~(O_TRUNC); /* Todo: Are there any more flag combos to sanitise ? */