From 36ee8a8c259cb77de90d655262d74c3ce4b45f22 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Thu, 29 Apr 2021 21:31:33 +0200 Subject: [PATCH] LibC: Make rewind() ignore errors as it should POSIX says that rewind() should ignore errors and reset the stream's error indicator. So let's do that. --- Userland/Libraries/LibC/stdio.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Userland/Libraries/LibC/stdio.cpp b/Userland/Libraries/LibC/stdio.cpp index d729222997d4c6..7380700d05089e 100644 --- a/Userland/Libraries/LibC/stdio.cpp +++ b/Userland/Libraries/LibC/stdio.cpp @@ -873,10 +873,8 @@ int fsetpos(FILE* stream, const fpos_t* pos) void rewind(FILE* stream) { - VERIFY(stream); - ScopedFileLock lock(stream); - int rc = stream->seek(0, SEEK_SET); - VERIFY(rc == 0); + fseek(stream, 0, SEEK_SET); + clearerr(stream); } ALWAYS_INLINE void stdout_putch(char*&, char ch)