From 124c588f817f0de8a01fd14d469d87bd03b8355d Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 19 Feb 2020 23:12:29 +0100 Subject: [PATCH] LibC: Don't assert on fflush(nullptr) We're supposed to flush all open streams when this happens, but since we don't know how to do that yet, let's just log a FIXME and not crash. --- Libraries/LibC/stdio.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Libraries/LibC/stdio.cpp b/Libraries/LibC/stdio.cpp index 60813c0861..e0c289d518 100644 --- a/Libraries/LibC/stdio.cpp +++ b/Libraries/LibC/stdio.cpp @@ -115,8 +115,10 @@ int feof(FILE* stream) int fflush(FILE* stream) { - // FIXME: fflush(NULL) should flush all open output streams. - ASSERT(stream); + if (!stream) { + dbg() << "FIXME: fflush(nullptr) should flush all open streams"; + return 0; + } if (!stream->buffer_index) return 0; int rc = write(stream->fd, stream->buffer, stream->buffer_index);