4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-02-21 00:07:36 +08:00

__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>
This commit is contained in:
Corinna Vinschen 2023-11-17 17:00:54 +01:00
parent 61ccd3f94f
commit 6ccbfe6a3d

View File

@ -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--;