mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:37:35 +00:00
Kernel: Pass path+length to mkdir(), rmdir() and chmod()
This commit is contained in:
parent
53d3b6b0a7
commit
0df72d4712
4 changed files with 47 additions and 26 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue