From: Charles Manning Date: Mon, 23 Aug 2010 22:12:15 +0000 (+1200) Subject: yaffs Fix problem trying to mkdir a mountpt in yaffs direct X-Git-Tag: pre-name-change~17^2~2 X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=commitdiff_plain;h=213dc0b42fbe8652e454bfdbf9f5c41c6eb4974c yaffs Fix problem trying to mkdir a mountpt in yaffs direct yaffs_mkdir would create a directory if you passed the name of a mount point. This change fails such attempts with -EEXIST. tested with: "yaffs2" "/yaffs2" "/yaffs2/" "/yaffs2///////" "yaffs2////" Signed-off-by: Charles Manning --- diff --git a/direct/yaffsfs.c b/direct/yaffsfs.c index d9be490..9ac08ab 100644 --- a/direct/yaffsfs.c +++ b/direct/yaffsfs.c @@ -1637,7 +1637,10 @@ int yaffs_mkdir(const YCHAR *path, mode_t mode) yaffsfs_Lock(); parent = yaffsfs_FindDirectory(NULL,path,&name,0); - if(parent && parent->myDev->readOnly){ + if(parent && yaffs_strnlen(name,5) == 0){ + /* Trying to make the root itself */ + yaffsfs_SetError(-EEXIST); + } else if(parent && parent->myDev->readOnly){ yaffsfs_SetError(-EINVAL); } else { if(parent)