forked from Bananymous/banan-os
Kernel/LibC: Implement all chown family function with fchownat
This commit is contained in:
@@ -57,7 +57,7 @@ __BEGIN_DECLS
|
||||
O(SYS_READLINKAT, readlinkat) \
|
||||
O(SYS_MSYNC, msync) \
|
||||
O(SYS_PREAD, pread) \
|
||||
O(SYS_CHOWN, chown) \
|
||||
O(SYS_FCHOWNAT, fchownat) \
|
||||
O(SYS_LOAD_KEYMAP, load_keymap) \
|
||||
O(SYS_SOCKET, socket) \
|
||||
O(SYS_BIND, bind) \
|
||||
|
||||
@@ -315,7 +315,22 @@ int chdir(const char* path)
|
||||
|
||||
int chown(const char* path, uid_t owner, gid_t group)
|
||||
{
|
||||
return syscall(SYS_CHOWN, path, owner, group);
|
||||
return fchownat(AT_FDCWD, path, owner, group, 0);
|
||||
}
|
||||
|
||||
int lchown(const char* path, uid_t owner, gid_t group)
|
||||
{
|
||||
return fchownat(AT_FDCWD, path, owner, group, AT_SYMLINK_NOFOLLOW);
|
||||
}
|
||||
|
||||
int fchown(int fildes, uid_t owner, gid_t group)
|
||||
{
|
||||
return fchownat(fildes, nullptr, owner, group, 0);
|
||||
}
|
||||
|
||||
int fchownat(int fd, const char* path, uid_t owner, gid_t group, int flag)
|
||||
{
|
||||
return syscall(SYS_FCHOWNAT, fd, path, owner, group, flag);
|
||||
}
|
||||
|
||||
void sync(void)
|
||||
|
||||
Reference in New Issue
Block a user