public inbox for newlib-cvs@sourceware.org help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org> To: newlib-cvs@sourceware.org Subject: [newlib-cygwin/main] __sfvwrite_r: call __sputc_r rather than putc in __SCLE case Date: Fri, 17 Nov 2023 16:09:56 +0000 (GMT) [thread overview] Message-ID: <20231117160956.14FF43858416@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=6ccbfe6a3d8a2aedb2c6f80bcc03bf946acc1b6c commit 6ccbfe6a3d8a2aedb2c6f80bcc03bf946acc1b6c Author: Corinna Vinschen <corinna@vinschen.de> AuthorDate: Fri Nov 17 17:00:54 2023 +0100 Commit: Corinna Vinschen <corinna@vinschen.de> CommitDate: Fri Nov 17 17:09:42 2023 +0100 __sfvwrite_r: call __sputc_r rather than putc in __SCLE case __sfvwrite_r is called under lock. There's no reason to call putc, locking the file recursively. Add a comment that locking is required when calling __sfvwrite_r. Fixes: 49d64538cd20 ("* libc/include/stdio.h (FILE): define __SCLE for "convert line endings" for Cygwin.") Signed-off-by: Corinna Vinschen <corinna@vinschen.de> Diff: --- newlib/libc/stdio/fvwrite.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/newlib/libc/stdio/fvwrite.c b/newlib/libc/stdio/fvwrite.c index 34361cb8d135..fc79951032ad 100644 --- a/newlib/libc/stdio/fvwrite.c +++ b/newlib/libc/stdio/fvwrite.c @@ -40,6 +40,9 @@ /* * Write some memory regions. Return zero on success, EOF on error. * + * On systems supporting threads, this function *must* be called under + * _newlib_flockfile_start locking. + * * This routine is large and unsightly, but most of the ugliness due * to the three different kinds of output buffering is handled here. */ @@ -74,7 +77,7 @@ __sfvwrite_r (struct _reent *ptr, GETIOV (;); while (len > 0) { - if (putc (*p, fp) == EOF) + if (__sputc_r (ptr, *p, fp) == EOF) return EOF; p++; len--;
reply other threads:[~2023-11-17 16:09 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20231117160956.14FF43858416@sourceware.org \ --to=corinna@sourceware.org \ --cc=newlib-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).