1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:48:12 +00:00

Kernel: Pass a parameter struct to rename()

This commit is contained in:
Andreas Kling 2020-01-11 10:36:54 +01:00
parent 46830a0c32
commit e380142853
4 changed files with 23 additions and 8 deletions

View file

@ -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);
}