Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/newlib
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2023-11-17 19:00:54 +0300
committerCorinna Vinschen <corinna@vinschen.de>2023-11-17 19:09:42 +0300
commit6ccbfe6a3d8a2aedb2c6f80bcc03bf946acc1b6c (patch)
tree3c4ebc0b4bbe0a85f6957fb3276254356cdc212c /newlib
parent61ccd3f94f92bcfc0940f0595ea5b3b72bce3c6d (diff)
__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>
Diffstat (limited to 'newlib')
-rw-r--r--newlib/libc/stdio/fvwrite.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/newlib/libc/stdio/fvwrite.c b/newlib/libc/stdio/fvwrite.c
index 34361cb8d..fc7995103 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--;