mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Fix LinkInodeInDir return value.
The callers expected it to return an int different than 0 on failure. The link method returns different than 0 on failure. This actually worked by lucky coincidence. Change the return type to int and 0 on success, and -1 on failure per popular demand. Thanks to Meisaka Yukara for spotting this.
This commit is contained in:
parent
275541383c
commit
6725972e11
2 changed files with 9 additions and 9 deletions
|
@ -61,18 +61,18 @@ static const int OPEN_FLAGS = O_CREATE | O_DIRECTORY | O_EXCL | O_TRUNC |
|
|||
// Flags that only make sense for descriptors.
|
||||
static const int DESCRIPTOR_FLAGS = O_APPEND | O_NONBLOCK;
|
||||
|
||||
bool LinkInodeInDir(ioctx_t* ctx,
|
||||
Ref<Descriptor> dir,
|
||||
const char* name,
|
||||
Ref<Inode> inode)
|
||||
int LinkInodeInDir(ioctx_t* ctx,
|
||||
Ref<Descriptor> dir,
|
||||
const char* name,
|
||||
Ref<Inode> inode)
|
||||
{
|
||||
Ref<Vnode> vnode(new Vnode(inode, Ref<Vnode>(), 0, 0));
|
||||
if ( !vnode )
|
||||
return false;
|
||||
return -1;
|
||||
Ref<Descriptor> desc(new Descriptor(Ref<Vnode>(vnode), 0));
|
||||
if ( !desc )
|
||||
return false;
|
||||
return dir->link(ctx, name, desc) != 0;
|
||||
return -1;
|
||||
return dir->link(ctx, name, desc);
|
||||
}
|
||||
|
||||
Ref<Descriptor> OpenDirContainingPath(ioctx_t* ctx,
|
||||
|
|
|
@ -132,8 +132,8 @@ private:
|
|||
|
||||
};
|
||||
|
||||
bool LinkInodeInDir(ioctx_t* ctx, Ref<Descriptor> dir, const char* name,
|
||||
Ref<Inode> inode);
|
||||
int LinkInodeInDir(ioctx_t* ctx, Ref<Descriptor> dir, const char* name,
|
||||
Ref<Inode> inode);
|
||||
Ref<Descriptor> OpenDirContainingPath(ioctx_t* ctx, Ref<Descriptor> from,
|
||||
const char* path, char** finalp);
|
||||
|
||||
|
|
Loading…
Reference in a new issue