mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:47:45 +00:00
Kernel: Use for-each loops in unveil syscall
This commit is contained in:
parent
bc15144972
commit
cb167ea388
1 changed files with 3 additions and 4 deletions
|
@ -71,8 +71,8 @@ int Process::sys$unveil(Userspace<const Syscall::SC_unveil_params*> user_params)
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
unsigned new_permissions = 0;
|
unsigned new_permissions = 0;
|
||||||
for (size_t i = 0; i < permissions.length(); ++i) {
|
for (const char permission : permissions) {
|
||||||
switch (permissions[i]) {
|
switch (permission) {
|
||||||
case 'r':
|
case 'r':
|
||||||
new_permissions |= UnveiledPath::Access::Read;
|
new_permissions |= UnveiledPath::Access::Read;
|
||||||
break;
|
break;
|
||||||
|
@ -90,8 +90,7 @@ int Process::sys$unveil(Userspace<const Syscall::SC_unveil_params*> user_params)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < m_unveiled_paths.size(); ++i) {
|
for (auto& unveiled_path : m_unveiled_paths) {
|
||||||
auto& unveiled_path = m_unveiled_paths[i];
|
|
||||||
if (unveiled_path.path == new_unveiled_path) {
|
if (unveiled_path.path == new_unveiled_path) {
|
||||||
if (new_permissions & ~unveiled_path.permissions)
|
if (new_permissions & ~unveiled_path.permissions)
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue