libroot: Clean up and unify link/linkat.
* Move Haiku -> POSIX error mapping to linkat. * Implement link in terms of linkat.
This commit is contained in:
@@ -77,19 +77,19 @@ unlinkat(int fd, const char *path, int flag)
|
||||
int
|
||||
link(const char *toPath, const char *linkPath)
|
||||
{
|
||||
int status = _kern_create_link(-1, linkPath, -1, toPath, true);
|
||||
// Haiku -> POSIX error mapping
|
||||
if (status == B_UNSUPPORTED)
|
||||
status = EPERM;
|
||||
|
||||
RETURN_AND_SET_ERRNO(status);
|
||||
return linkat(AT_FDCWD, toPath, AT_FDCWD, linkPath, 0);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
linkat(int toFD, const char *toPath, int linkFD, const char *linkPath, int flag)
|
||||
{
|
||||
RETURN_AND_SET_ERRNO(_kern_create_link(linkFD, linkPath, toFD, toPath,
|
||||
(flag & AT_SYMLINK_FOLLOW) != 0));
|
||||
}
|
||||
int status = _kern_create_link(linkFD, linkPath, toFD, toPath,
|
||||
(flag & AT_SYMLINK_FOLLOW) != 0);
|
||||
|
||||
// Haiku -> POSIX error mapping
|
||||
if (status == B_UNSUPPORTED)
|
||||
status = EPERM;
|
||||
|
||||
RETURN_AND_SET_ERRNO(status);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user