You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2023/10/29 15:09:25 UTC

(nuttx) 01/03: libc/stdio: lib_fwrite_unlocked must call lib_fflush_unlocked with true

This is an automated email from the ASF dual-hosted git repository.

pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit c3be772441cfebbf0e87226087081dd2a6c0d0de
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sun Oct 22 04:51:59 2023 +0800

    libc/stdio: lib_fwrite_unlocked must call lib_fflush_unlocked with true
    
    otherwise the following file i/o mess up the output
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 libs/libc/stdio/lib_libfwrite.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libs/libc/stdio/lib_libfwrite.c b/libs/libc/stdio/lib_libfwrite.c
index 8150b1cff6..f5730c4dbe 100644
--- a/libs/libc/stdio/lib_libfwrite.c
+++ b/libs/libc/stdio/lib_libfwrite.c
@@ -130,7 +130,7 @@ ssize_t lib_fwrite_unlocked(FAR const void *ptr, size_t count,
         {
           /* Flush the buffered data to the IO stream */
 
-          int bytes_buffered = lib_fflush_unlocked(stream, false);
+          int bytes_buffered = lib_fflush_unlocked(stream, true);
           if (bytes_buffered < 0)
             {
               goto errout;