LibCore: Ignore non-S_IFMT bits in directory_entry_type_from_stat

The st_mode field in struct stat is a bitfield of more than just the
file type, this commit masks off the non-filetype bits to ensure no
unrelated bits are checked.
This commit is contained in:
Ali Mohammad Pur 2023-12-01 21:09:46 +03:30 committed by Andreas Kling
parent b545427d53
commit 7edc69dc94

View file

@ -11,7 +11,7 @@ namespace Core {
static DirectoryEntry::Type directory_entry_type_from_stat(mode_t st_mode)
{
switch (st_mode) {
switch (st_mode & S_IFMT) {
case S_IFIFO:
return DirectoryEntry::Type::NamedPipe;
case S_IFCHR: