Check for existing directories at Vfs::Dir_file_system

Return OPENDIR_ERR_NODE_ALREADY_EXISTS for existing directories.
Remove deprecated 'is_directory' method.

Fix #3083
This commit is contained in:
Emery Hemingway 2018-12-11 18:40:34 +01:00 committed by Christian Helmuth
parent c41fbe9ea5
commit 93fb79f357

View File

@ -536,7 +536,7 @@ class Vfs::Dir_file_system : public File_system
{
path = _sub_path(path);
if (!path)
return 0;
return nullptr;
if (strlen(path) == 0)
return path;
@ -547,7 +547,7 @@ class Vfs::Dir_file_system : public File_system
return leaf_path;
}
return 0;
return nullptr;
}
Open_result open(char const *path,
@ -686,6 +686,9 @@ class Vfs::Dir_file_system : public File_system
return OPENDIR_ERR_LOOKUP_FAILED;
if (create) {
if (leaf_path(path) != nullptr)
return OPENDIR_ERR_NODE_ALREADY_EXISTS;
auto opendir_fn = [&] (File_system &fs, char const *path)
{
Vfs_handle *tmp_handle;