fs: mkdir return EEXIST if the path already exist

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ie1808697b860974367c17e0ba614ca5cae79f324
This commit is contained in:
Xiang Xiao 2021-07-17 23:15:33 +08:00 committed by Alan Carvalho de Assis
parent 7053707e0a
commit 02a6966ad5

View File

@ -79,6 +79,12 @@ int mkdir(const char *pathname, mode_t mode)
inode = desc.node; inode = desc.node;
DEBUGASSERT(inode != NULL); DEBUGASSERT(inode != NULL);
if (desc.relpath[0] == '\0')
{
errcode = EEXIST;
goto errout_with_inode;
}
#ifndef CONFIG_DISABLE_MOUNTPOINT #ifndef CONFIG_DISABLE_MOUNTPOINT
/* Check if the inode is a valid mountpoint. */ /* Check if the inode is a valid mountpoint. */