From 90e229c9b5711bb6aa90a145722b85d9930532ee Mon Sep 17 00:00:00 2001 From: Max Wipfli Date: Fri, 11 Jun 2021 10:55:43 +0200 Subject: [PATCH] Kernel: Use m_inode to stat in FileDescription::stat() if available This is necessary since the Device class does not hold a reference to its inode (because there could be multiple), and thus doesn't override File::stat(). For simplicity, we should just always stat via the inode if there is one, since that shouldn't ever be the wrong thing. This partially reverts #7867. --- Kernel/FileSystem/FileDescription.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Kernel/FileSystem/FileDescription.cpp b/Kernel/FileSystem/FileDescription.cpp index 20ba9a03d1..565b19d54a 100644 --- a/Kernel/FileSystem/FileDescription.cpp +++ b/Kernel/FileSystem/FileDescription.cpp @@ -110,6 +110,9 @@ Thread::FileBlocker::BlockFlags FileDescription::should_unblock(Thread::FileBloc KResult FileDescription::stat(::stat& buffer) { Locker locker(m_lock); + // FIXME: This is due to the Device class not overriding File::stat(). + if (m_inode) + return m_inode->metadata().stat(buffer); return m_file->stat(buffer); }