Kernel/LibC: Implement all chmod family functions using fchmodat

This commit is contained in:
2024-09-17 17:16:46 +03:00
parent 04ae53b6df
commit 4aa466b948
4 changed files with 34 additions and 22 deletions

View File

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