Honor O_EXCL only if O_CREAT.
This commit is contained in:
parent
4f7c5ebdd3
commit
ebb75f656c
|
@ -390,7 +390,7 @@ Inode* Inode::Open(const char* elem, int flags, mode_t mode)
|
||||||
uint32_t inode_id = entry->inode;
|
uint32_t inode_id = entry->inode;
|
||||||
assert(inode_id);
|
assert(inode_id);
|
||||||
block->Unref();
|
block->Unref();
|
||||||
if ( flags & O_EXCL )
|
if ( (flags & O_CREAT) && (flags & O_EXCL) )
|
||||||
return errno = EEXIST, (Inode*) NULL;
|
return errno = EEXIST, (Inode*) NULL;
|
||||||
if ( (flags & O_DIRECTORY) &&
|
if ( (flags & O_DIRECTORY) &&
|
||||||
file_type != EXT2_FT_UNKNOWN &&
|
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);
|
size_t child_index = FindChild(filename);
|
||||||
if ( child_index != SIZE_MAX )
|
if ( child_index != SIZE_MAX )
|
||||||
{
|
{
|
||||||
if ( flags & O_EXCL )
|
if ( (flags & O_CREATE) && (flags & O_EXCL) )
|
||||||
return errno = EEXIST, Ref<Inode>(NULL);
|
return errno = EEXIST, Ref<Inode>(NULL);
|
||||||
return children[child_index].inode;
|
return children[child_index].inode;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue