From d5f66e5583bf8f29acc31c545d84325baf20bdf9 Mon Sep 17 00:00:00 2001 From: SPRESENSE <41312067+SPRESENSE@users.noreply.github.com> Date: Fri, 27 Nov 2020 19:46:07 +0900 Subject: [PATCH] stdio/lib_clearerr: Did not clear stream buffer flags in clearerr Stream buffer flags has a dependency with allocated buffer, and it cannot clear without buffer operation. Change clearerr to keep buffer flags to prevent unexpected buffer operation. --- libs/libc/stdio/lib_clearerr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/libc/stdio/lib_clearerr.c b/libs/libc/stdio/lib_clearerr.c index 20a69c8996..39e6b74da9 100644 --- a/libs/libc/stdio/lib_clearerr.c +++ b/libs/libc/stdio/lib_clearerr.c @@ -48,6 +48,6 @@ void clearerr(FAR FILE *stream) { - stream->fs_flags = 0; + stream->fs_flags &= (__FS_FLAG_LBF | __FS_FLAG_UBF); } #endif /* CONFIG_FILE_STREAM */