Kernel: Fix directory permissions
We did not care about X bit in directories and instead used only the R bit for search/read.
This commit is contained in:
@@ -11,38 +11,15 @@ int fstat(int fildes, struct stat* buf)
|
||||
|
||||
int fstatat(int fd, const char* __restrict path, struct stat* __restrict buf, int flag)
|
||||
{
|
||||
if (flag == AT_SYMLINK_NOFOLLOW)
|
||||
flag = O_NOFOLLOW;
|
||||
else if (flag)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int target = openat(fd, path, O_SEARCH | flag);
|
||||
if (target == -1)
|
||||
return -1;
|
||||
int ret = fstat(target, buf);
|
||||
close(target);
|
||||
return ret;
|
||||
return syscall(SYS_FSTATAT, fd, path, buf, flag);
|
||||
}
|
||||
|
||||
int lstat(const char* __restrict path, struct stat* __restrict buf)
|
||||
{
|
||||
int fd = open(path, O_SEARCH | O_NOFOLLOW);
|
||||
if (fd == -1)
|
||||
return -1;
|
||||
int ret = fstat(fd, buf);
|
||||
close(fd);
|
||||
return ret;
|
||||
return syscall(SYS_STAT, path, buf, AT_SYMLINK_NOFOLLOW);
|
||||
}
|
||||
|
||||
int stat(const char* __restrict path, struct stat* __restrict buf)
|
||||
{
|
||||
int fd = open(path, O_SEARCH);
|
||||
if (fd == -1)
|
||||
return -1;
|
||||
int ret = fstat(fd, buf);
|
||||
close(fd);
|
||||
return ret;
|
||||
return syscall(SYS_STAT, path, buf, 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user