소스 검색

Kernel: Do not panic on fstat(fifo)

Instead, let's return an empty buffer with st_mode indicating it's a fifo.
Sergey Bugaev 5 년 전
부모
커밋
e9dd94063f
1개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 1
      Kernel/FileSystem/FileDescription.cpp

+ 6 - 1
Kernel/FileSystem/FileDescription.cpp

@@ -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);