+ /* If the last character is a path divider, then we need to
+ * trim it back so that the name look-up works properly.
+ * eg. /foo/new_dir/ -> /foo/newdir
+ * Curveball: Need to handle multiple path dividers:
+ * eg. /foof/sdfse///// -> /foo/sdfse
+ */
+ if(path_length > 0 &&
+ yaffsfs_IsPathDivider(path[path_length-1])){
+ use_path = YMALLOC(path_length + 1);
+ if(!use_path){
+ yaffsfs_SetError(-ENOMEM);
+ return -1;
+ }
+ strcpy(use_path, path);
+ for(i = path_length-1;
+ i >= 0 && yaffsfs_IsPathDivider(use_path[i]);
+ i--)
+ use_path[i] = (YCHAR) 0;
+ path = use_path;
+ }
+