Kernel/LibC: Implement all chmod family functions using fchmodat
This commit is contained in:
@@ -51,8 +51,7 @@ __BEGIN_DECLS
|
||||
O(SYS_MUNMAP, munmap) \
|
||||
O(SYS_TTY_CTRL, tty_ctrl) \
|
||||
O(SYS_POWEROFF, poweroff) \
|
||||
O(SYS_CHMOD, chmod) \
|
||||
O(SYS_FCHMOD, fchmod) \
|
||||
O(SYS_FCHMODAT, fchmodat) \
|
||||
O(SYS_CREATE_DIR, create_dir) \
|
||||
O(SYS_UNLINK, unlink) \
|
||||
O(SYS_READLINKAT, readlinkat) \
|
||||
|
||||
@@ -9,12 +9,17 @@ mode_t __umask = 0;
|
||||
|
||||
int chmod(const char* path, mode_t mode)
|
||||
{
|
||||
return syscall(SYS_CHMOD, path, mode);
|
||||
return fchmodat(AT_FDCWD, path, mode, 0);
|
||||
}
|
||||
|
||||
int fchmod(int fildes, mode_t mode)
|
||||
{
|
||||
return syscall(SYS_FCHMOD, fildes, mode);
|
||||
return fchmodat(fildes, nullptr, mode, 0);
|
||||
}
|
||||
|
||||
int fchmodat(int fildes, const char* path, mode_t mode, int flag)
|
||||
{
|
||||
return syscall(SYS_FCHMODAT, fildes, path, mode, flag);
|
||||
}
|
||||
|
||||
int fstat(int fildes, struct stat* buf)
|
||||
|
||||
Reference in New Issue
Block a user