[Kernel/IO] Return error creating dir as non-dir.
[Kernel/IO] Return error when creating directory with non-directory flag in NtCreateFile.
This commit is contained in:
@@ -172,7 +172,8 @@ X_STATUS VirtualFileSystem::OpenFile(Entry* root_entry,
|
||||
const std::string_view path,
|
||||
FileDisposition creation_disposition,
|
||||
uint32_t desired_access, bool is_directory,
|
||||
File** out_file, FileAction* out_action) {
|
||||
bool is_non_directory, File** out_file,
|
||||
FileAction* out_action) {
|
||||
// TODO(gibbed): should 'is_directory' remain as a bool or should it be
|
||||
// flipped to a generic FileAttributeFlags?
|
||||
|
||||
@@ -207,6 +208,12 @@ X_STATUS VirtualFileSystem::OpenFile(Entry* root_entry,
|
||||
entry = !root_entry ? ResolvePath(path) : root_entry->GetChild(path);
|
||||
}
|
||||
|
||||
if (entry) {
|
||||
if (entry->attributes() & kFileAttributeDirectory && is_non_directory) {
|
||||
return X_STATUS_FILE_IS_A_DIRECTORY;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if exists (if we need it to), or that it doesn't (if it shouldn't).
|
||||
switch (creation_disposition) {
|
||||
case FileDisposition::kOpen:
|
||||
|
||||
Reference in New Issue
Block a user