public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin/main] _fputwc_r: actually return result of __fputwc
@ 2024-01-19 10:52 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2024-01-19 10:52 UTC (permalink / raw)
  To: newlib-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=d13d9220bf47f7e91b02c5c8e214780bda840606

commit d13d9220bf47f7e91b02c5c8e214780bda840606
Author:     Corinna Vinschen <corinna@vinschen.de>
AuthorDate: Fri Jan 19 11:13:39 2024 +0100
Commit:     Corinna Vinschen <corinna@vinschen.de>
CommitDate: Fri Jan 19 11:13:39 2024 +0100

    _fputwc_r: actually return result of __fputwc
    
    Compiling with -Wall uncovered a bug in _fputwc_r introduced in
    commit 09119463a1445 ("stdio: split byte- and wide-char-oriented
    low-level output functions").  The underlying function __fputwc
    has been accidentally called without fetching its return value.
    So the return value of _fputwc_r (and thus fputwc) was undefined.
    
    Fixes: 09119463a1445 ("stdio: split byte- and wide-char-oriented low-level output functions"
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 newlib/libc/stdio/fputwc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/newlib/libc/stdio/fputwc.c b/newlib/libc/stdio/fputwc.c
index 8430446dea40..12a6170bbc55 100644
--- a/newlib/libc/stdio/fputwc.c
+++ b/newlib/libc/stdio/fputwc.c
@@ -169,7 +169,7 @@ _fputwc_r (struct _reent *ptr,
   wint_t r;
 
   _newlib_flockfile_start (fp);
-  __fputwc(ptr, wc, fp);
+  r = __fputwc(ptr, wc, fp);
   _newlib_flockfile_end (fp);
   return r;
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-19 10:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-19 10:52 [newlib-cygwin/main] _fputwc_r: actually return result of __fputwc Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).