1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:58:11 +00:00

Kernel: Use symbolic constants for file modes

This fixes a bug where the mode of a FIFO was reported as 001000 instead
of 0010000 (you see the difference? me nethier), and hopefully doesn't
introduce new bugs. I've left 0777 and similar in a few places, because
that is *more* readable than its symbolic version.
This commit is contained in:
Sergey Bugaev 2020-06-16 22:03:51 +03:00 committed by Andreas Kling
parent fd985b1f48
commit e0d0d52455
5 changed files with 52 additions and 30 deletions

View file

@ -1144,30 +1144,30 @@ InodeMetadata ProcFSInode::metadata() const
}
if (proc_parent_directory == PDI_PID_fd) {
metadata.mode = 00120700;
metadata.mode = S_IFLNK | S_IRUSR | S_IWUSR | S_IXUSR;
return metadata;
}
switch (proc_file_type) {
case FI_Root_self:
metadata.mode = 0120444;
metadata.mode = S_IFLNK | S_IRUSR | S_IRGRP | S_IROTH;
break;
case FI_PID_cwd:
case FI_PID_exe:
case FI_PID_root:
metadata.mode = 0120400;
metadata.mode = S_IFLNK | S_IRUSR;
break;
case FI_Root:
case FI_Root_sys:
case FI_Root_net:
metadata.mode = 040555;
metadata.mode = S_IFDIR | S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
break;
case FI_PID:
case FI_PID_fd:
metadata.mode = 040500;
metadata.mode = S_IFDIR | S_IRUSR | S_IXUSR;
break;
default:
metadata.mode = 0100444;
metadata.mode = S_IFREG | S_IRUSR | S_IRGRP | S_IROTH;
break;
}