diff --git a/repos/os/include/vfs/dir_file_system.h b/repos/os/include/vfs/dir_file_system.h index c23ba6a1d6..9afd9897be 100644 --- a/repos/os/include/vfs/dir_file_system.h +++ b/repos/os/include/vfs/dir_file_system.h @@ -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;