From 213dc0b42fbe8652e454bfdbf9f5c41c6eb4974c Mon Sep 17 00:00:00 2001 From: Charles Manning Date: Tue, 24 Aug 2010 10:12:15 +1200 Subject: [PATCH] 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 --- direct/yaffsfs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) -- 2.30.2