Fix extfs O_DIRECTORY error codes.

This commit is contained in:
Jonas 'Sortie' Termansen 2015-02-04 13:16:48 +01:00
parent 22a510e957
commit a22cca77f5
1 changed files with 2 additions and 2 deletions

View File

@ -396,14 +396,14 @@ Inode* Inode::Open(const char* elem, int flags, mode_t mode)
file_type != EXT2_FT_UNKNOWN &&
file_type != EXT2_FT_DIR &&
file_type != EXT2_FT_SYMLINK )
return errno = EEXIST, (Inode*) NULL;
return errno = ENOTDIR, (Inode*) NULL;
Inode* inode = filesystem->GetInode(inode_id);
if ( flags & O_DIRECTORY &&
!EXT2_S_ISDIR(inode->Mode()) &&
!EXT2_S_ISLNK(inode->Mode()) )
{
inode->Unref();
return errno = EEXIST, (Inode*) NULL;
return errno = ENOTDIR, (Inode*) NULL;
}
if ( S_ISREG(inode->Mode()) && flags & O_TRUNC )
inode->Truncate(0);