1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:27:45 +00:00

Kernel: FileDescription::is_directory() should not assert !is_fifo()

I have no idea why this was here. It makes no sense. If you're trying
to find out if something is a directory, why wouldn't you be allowed to
ask that about a FIFO? :^)

Thanks to Brandon for spotting this!

Also, while we're here, cache the directory state in a bool member so
we don't have to keep fetching inode metadata when checking this
repeatedly. This is important since sys$read() now calls it.
This commit is contained in:
Andreas Kling 2019-10-25 09:22:22 +02:00
parent 4e25d69dba
commit 558c63a6f9
2 changed files with 6 additions and 8 deletions

View file

@ -44,7 +44,7 @@ public:
String absolute_path() const;
bool is_directory() const;
bool is_directory() const { return m_is_directory; }
File& file() { return *m_file; }
const File& file() const { return *m_file; }
@ -115,6 +115,7 @@ private:
u32 m_file_flags { 0 };
bool m_is_blocking { true };
bool m_is_directory { false };
bool m_should_append { false };
FIFO::Direction m_fifo_direction { FIFO::Direction::Neither };
};