diff options
author | Andreas Kling <kling@serenityos.org> | 2021-09-07 13:56:10 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-07 13:58:16 +0200 |
commit | ed5d04b0ead11ecc452db9416bdccc4da9ca92ef (patch) | |
tree | 0c1aafd4d8a44ea83a0178441aa01e164311ab28 /Kernel/FileSystem/Inode.cpp | |
parent | 631b8e90cd1c271e23d92c46f578fc9cd6dbb81d (diff) | |
download | serenity-ed5d04b0ead11ecc452db9416bdccc4da9ca92ef.zip |
Kernel: Use KResultOr and TRY() for FIFO
Diffstat (limited to 'Kernel/FileSystem/Inode.cpp')
-rw-r--r-- | Kernel/FileSystem/Inode.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/Kernel/FileSystem/Inode.cpp b/Kernel/FileSystem/Inode.cpp index bfb7186e29..b301745df4 100644 --- a/Kernel/FileSystem/Inode.cpp +++ b/Kernel/FileSystem/Inode.cpp @@ -163,19 +163,15 @@ void Inode::unregister_watcher(Badge<InodeWatcher>, InodeWatcher& watcher) m_watchers.remove(&watcher); } -NonnullRefPtr<FIFO> Inode::fifo() +KResultOr<NonnullRefPtr<FIFO>> Inode::fifo() { MutexLocker locker(m_inode_lock); VERIFY(metadata().is_fifo()); // FIXME: Release m_fifo when it is closed by all readers and writers - if (!m_fifo) { - m_fifo = FIFO::try_create(metadata().uid); - // FIXME: We need to be able to observe OOM here. - VERIFY(!m_fifo.is_null()); - } + if (!m_fifo) + m_fifo = TRY(FIFO::try_create(metadata().uid)); - VERIFY(m_fifo); return *m_fifo; } |