1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:27:35 +00:00

Kernel: Pass path+length to mkdir(), rmdir() and chmod()

This commit is contained in:
Andreas Kling 2020-01-06 11:05:59 +01:00
parent 53d3b6b0a7
commit 0df72d4712
4 changed files with 47 additions and 26 deletions

View file

@ -2,6 +2,7 @@
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
extern "C" {
@ -13,13 +14,21 @@ mode_t umask(mode_t mask)
int mkdir(const char* pathname, mode_t mode)
{
int rc = syscall(SC_mkdir, pathname, mode);
if (!pathname) {
errno = EFAULT;
return -1;
}
int rc = syscall(SC_mkdir, pathname, strlen(pathname), mode);
__RETURN_WITH_ERRNO(rc, rc, -1);
}
int chmod(const char* pathname, mode_t mode)
{
int rc = syscall(SC_chmod, pathname, mode);
if (!pathname) {
errno = EFAULT;
return -1;
}
int rc = syscall(SC_chmod, pathname, strlen(pathname), mode);
__RETURN_WITH_ERRNO(rc, rc, -1);
}