Kernel: Do not panic on fstat(fifo)

Instead, let's return an empty buffer with st_mode indicating it's a fifo.
This commit is contained in:
Sergey Bugaev 2019-09-17 21:39:44 +03:00 committed by Andreas Kling
parent 68c06b8fac
commit e9dd94063f
Notes: sideshowbarker 2024-07-19 12:04:17 +09:00

View File

@ -48,7 +48,12 @@ FileDescription::~FileDescription()
KResult FileDescription::fstat(stat& buffer)
{
ASSERT(!is_fifo());
if (is_fifo()) {
memset(&buffer, 0, sizeof(buffer));
buffer.st_mode = 001000;
return KSuccess;
}
if (!m_inode)
return KResult(-EBADF);
return metadata().stat(buffer);