From 390275f867cea4be282b4a7ec160ff5f8b5ea18f Mon Sep 17 00:00:00 2001 From: guoshichao Date: Thu, 25 Apr 2024 19:13:21 +0800 Subject: [PATCH] wchar/putwc: fix the putwc return value truncate error Signed-off-by: guoshichao --- libs/libc/stdio/lib_putwc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libs/libc/stdio/lib_putwc.c b/libs/libc/stdio/lib_putwc.c index f7ad8c1002..f55221954b 100644 --- a/libs/libc/stdio/lib_putwc.c +++ b/libs/libc/stdio/lib_putwc.c @@ -76,10 +76,11 @@ wint_t putwc_unlocked(wchar_t c, FAR FILE *f) wint_t putwc(wchar_t c, FAR FILE *f) { + wint_t wc; flockfile(f); - c = putwc_unlocked(c, f); + wc = putwc_unlocked(c, f); funlockfile(f); - return c; + return wc; } #endif /* CONFIG_FILE_STREAM */