summaryrefslogtreecommitdiff
path: root/Libraries/LibC
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2020-01-10 21:26:47 +0100
committerAndreas Kling <awesomekling@gmail.com>2020-01-10 21:26:47 +0100
commit485443bfcaa02b728bc278fb2e4c08d907781752 (patch)
tree3d7015aaa607e8648d908ecc712a31659253a683 /Libraries/LibC
parent416c7ac2b5a9f01665637bfd9b9d124f5ffaf571 (diff)
downloadserenity-485443bfcaa02b728bc278fb2e4c08d907781752.zip
Kernel: Pass characters+length to link()
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);
}