mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:38:11 +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;
|
||||
|
||||
unsigned new_permissions = 0;
|
||||
for (size_t i = 0; i < permissions.length(); ++i) {
|
||||
switch (permissions[i]) {
|
||||
for (const char permission : permissions) {
|
||||
switch (permission) {
|
||||
case 'r':
|
||||
new_permissions |= UnveiledPath::Access::Read;
|
||||
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) {
|
||||
auto& unveiled_path = m_unveiled_paths[i];
|
||||
for (auto& unveiled_path : m_unveiled_paths) {
|
||||
if (unveiled_path.path == new_unveiled_path) {
|
||||
if (new_permissions & ~unveiled_path.permissions)
|
||||
return -EPERM;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue