summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibC/unistd.cpp
diff options
context:
space:
mode:
authorsin-ack <sin-ack@users.noreply.github.com>2022-10-01 11:15:02 +0000
committerAndrew Kaster <andrewdkaster@gmail.com>2022-12-11 19:55:37 -0700
commit9850a69cd199d48bc30a34e2fe38d5590b536aac (patch)
tree506a12437ac1651c9e25b2e08cdbc63ac80bf119 /Userland/Libraries/LibC/unistd.cpp
parent5c1d5ed51da2cf3b9463413f704ea0e740950736 (diff)
downloadserenity-9850a69cd199d48bc30a34e2fe38d5590b536aac.zip
Kernel+LibC+LibCore: Implement `symlinkat(2)`
Co-Authored-By: Daniel Bertalan <dani@danielbertalan.dev>
Diffstat (limited to 'Userland/Libraries/LibC/unistd.cpp')
-rw-r--r--Userland/Libraries/LibC/unistd.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/Userland/Libraries/LibC/unistd.cpp b/Userland/Libraries/LibC/unistd.cpp
index e3fbca0e9f..8e732f197a 100644
--- a/Userland/Libraries/LibC/unistd.cpp
+++ b/Userland/Libraries/LibC/unistd.cpp
@@ -673,11 +673,17 @@ int unlinkat(int dirfd, char const* pathname, int flags)
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/symlink.html
int symlink(char const* target, char const* linkpath)
{
+ return symlinkat(target, AT_FDCWD, linkpath);
+}
+
+// https://pubs.opengroup.org/onlinepubs/9699919799/functions/symlinkat.html
+int symlinkat(char const* target, int newdirfd, char const* linkpath)
+{
if (!target || !linkpath) {
errno = EFAULT;
return -1;
}
- Syscall::SC_symlink_params params { { target, strlen(target) }, { linkpath, strlen(linkpath) } };
+ Syscall::SC_symlink_params params { { target, strlen(target) }, { linkpath, strlen(linkpath) }, newdirfd };
int rc = syscall(SC_symlink, &params);
__RETURN_WITH_ERRNO(rc, rc, -1);
}