mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Honor O_EXCL only if O_CREAT.
This commit is contained in:
parent
4f7c5ebdd3
commit
ebb75f656c
2 changed files with 2 additions and 2 deletions
|
@ -390,7 +390,7 @@ Inode* Inode::Open(const char* elem, int flags, mode_t mode)
|
|||
uint32_t inode_id = entry->inode;
|
||||
assert(inode_id);
|
||||
block->Unref();
|
||||
if ( flags & O_EXCL )
|
||||
if ( (flags & O_CREAT) && (flags & O_EXCL) )
|
||||
return errno = EEXIST, (Inode*) NULL;
|
||||
if ( (flags & O_DIRECTORY) &&
|
||||
file_type != EXT2_FT_UNKNOWN &&
|
||||
|
|
|
@ -238,7 +238,7 @@ Ref<Inode> Dir::open(ioctx_t* ctx, const char* filename, int flags, mode_t mode)
|
|||
size_t child_index = FindChild(filename);
|
||||
if ( child_index != SIZE_MAX )
|
||||
{
|
||||
if ( flags & O_EXCL )
|
||||
if ( (flags & O_CREATE) && (flags & O_EXCL) )
|
||||
return errno = EEXIST, Ref<Inode>(NULL);
|
||||
return children[child_index].inode;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue