summaryrefslogtreecommitdiff
path: root/Libraries/LibC/stdio.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2020-01-11 10:36:54 +0100
committerAndreas Kling <awesomekling@gmail.com>2020-01-11 10:36:54 +0100
commite380142853f2468a76a48a8c0036b1c46f977da9 (patch)
treedb28b032b15c8c9bba1b2368918c8e91c14ae6d3 /Libraries/LibC/stdio.cpp
parent46830a0c32930aac3bb390317a87ef42e84f4a07 (diff)
downloadserenity-e380142853f2468a76a48a8c0036b1c46f977da9.zip
Kernel: Pass a parameter struct to rename()
Diffstat (limited to 'Libraries/LibC/stdio.cpp')
-rw-r--r--Libraries/LibC/stdio.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/Libraries/LibC/stdio.cpp b/Libraries/LibC/stdio.cpp
index 5f93aba2bb..5a28d90325 100644
--- a/Libraries/LibC/stdio.cpp
+++ b/Libraries/LibC/stdio.cpp
@@ -510,7 +510,12 @@ int fclose(FILE* stream)
int rename(const char* oldpath, const char* newpath)
{
- int rc = syscall(SC_rename, oldpath, newpath);
+ if (!oldpath || !newpath) {
+ errno = EFAULT;
+ return -1;
+ }
+ Syscall::SC_rename_params params { { oldpath, strlen(oldpath) }, { newpath, strlen(newpath) } };
+ int rc = syscall(SC_rename, &params);
__RETURN_WITH_ERRNO(rc, rc, -1);
}