summaryrefslogtreecommitdiff
path: root/Libraries/LibC
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries/LibC')
-rw-r--r--Libraries/LibC/unistd.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/Libraries/LibC/unistd.cpp b/Libraries/LibC/unistd.cpp
index 8d63256b4a..da27a3b0e9 100644
--- a/Libraries/LibC/unistd.cpp
+++ b/Libraries/LibC/unistd.cpp
@@ -339,7 +339,12 @@ off_t lseek(int fd, off_t offset, int whence)
int link(const char* old_path, const char* new_path)
{
- int rc = syscall(SC_link, old_path, new_path);
+ if (!old_path || !new_path) {
+ errno = EFAULT;
+ return -1;
+ }
+ Syscall::SC_link_params params { { old_path, strlen(old_path) }, { new_path, strlen(new_path) } };
+ int rc = syscall(SC_link, &params);
__RETURN_WITH_ERRNO(rc, rc, -1);
}