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

LibC: Implement fflush(nullptr)

This caused all open file streams to be flushed.

This commit also changes `FILE::create` to handle buffer allocation
failure gracefully.
This commit is contained in:
Daniel Bertalan 2022-01-15 14:40:57 +01:00 committed by Brian Gianforcaro
parent b4e864d02d
commit 6a6dbf5b0b
3 changed files with 72 additions and 5 deletions

View file

@ -5,6 +5,7 @@
*/
#include <AK/Array.h>
#include <AK/IntrusiveList.h>
#include <AK/Types.h>
#include <LibC/bits/FILE.h>
#include <LibC/bits/pthread_integration.h>
@ -127,6 +128,10 @@ private:
pid_t m_popen_child { -1 };
Buffer m_buffer;
__pthread_mutex_t m_mutex;
IntrusiveListNode<FILE> m_list_node;
public:
using List = IntrusiveList<&FILE::m_list_node>;
};
class ScopedFileLock {