X-Git-Url: https://yaffs.net/gitweb/?p=yaffs2.git;a=blobdiff_plain;f=direct%2Fyaffsfs.c;h=dedd76ca08138e26bb0b0c9573f53111a7e36652;hp=69cf0a48ad9e424d7fc53890683cc1af61682e87;hb=1ebec0597a033cba1b18b32466bbd6b7dcfdcecb;hpb=9ec94eea1865dfb884640c4db487d6855f801107 diff --git a/direct/yaffsfs.c b/direct/yaffsfs.c index 69cf0a4..dedd76c 100644 --- a/direct/yaffsfs.c +++ b/direct/yaffsfs.c @@ -515,17 +515,17 @@ static struct yaffs_dev *yaffsfs_FindDevice(const YCHAR *path, 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 && @@ -539,6 +539,16 @@ static struct yaffs_dev *yaffsfs_FindDevice(const YCHAR *path, 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 */ @@ -559,7 +569,6 @@ static struct yaffs_dev *yaffsfs_FindDevice(const YCHAR *path, retval = dev; longestMatch = thisMatchLength; } - } return retval; }