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
|
int
|
||||||
link(const char *toPath, const char *linkPath)
|
link(const char *toPath, const char *linkPath)
|
||||||
{
|
{
|
||||||
int status = _kern_create_link(-1, linkPath, -1, toPath, true);
|
return linkat(AT_FDCWD, toPath, AT_FDCWD, linkPath, 0);
|
||||||
// Haiku -> POSIX error mapping
|
|
||||||
if (status == B_UNSUPPORTED)
|
|
||||||
status = EPERM;
|
|
||||||
|
|
||||||
RETURN_AND_SET_ERRNO(status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
linkat(int toFD, const char *toPath, int linkFD, const char *linkPath, int flag)
|
linkat(int toFD, const char *toPath, int linkFD, const char *linkPath, int flag)
|
||||||
{
|
{
|
||||||
RETURN_AND_SET_ERRNO(_kern_create_link(linkFD, linkPath, toFD, toPath,
|
int status = _kern_create_link(linkFD, linkPath, toFD, toPath,
|
||||||
(flag & AT_SYMLINK_FOLLOW) != 0));
|
(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