thisMatchLength = 0;
matching = 1;
+
if(!p)
continue;
- while (matching && *p && *leftOver) {
- /* Skip over any /s */
- while (yaffsfs_IsPathDivider(*p))
- p++;
+ /* Skip over any leading /s */
+ while (yaffsfs_IsPathDivider(*p))
+ p++;
+ while (yaffsfs_IsPathDivider(*leftOver))
+ leftOver++;
- /* Skip over any /s */
- while (yaffsfs_IsPathDivider(*leftOver))
- leftOver++;
+ while (matching && *p && *leftOver) {
/* Now match the text part */
while (matching &&
matching = 0;
}
}
+
+ if ((*p && !yaffsfs_IsPathDivider(*p)) ||
+ (*leftOver && !yaffsfs_IsPathDivider(*leftOver)))
+ matching = 0;
+ else {
+ while (yaffsfs_IsPathDivider(*p))
+ p++;
+ while (yaffsfs_IsPathDivider(*leftOver))
+ leftOver++;
+ }
}
/* Skip over any /s in leftOver */
retval = dev;
longestMatch = thisMatchLength;
}
-
}
return retval;
}
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;
}
obj = yaffsfs_FindObject(reldir, dirname, 0, 1, NULL, ¬Dir, &loop);
+ obj = yaffsfs_FollowLink(obj, 0, &loop);
if (!obj && notDir)
yaffsfs_SetError(-ENOTDIR);