1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00

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

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);