diff options
Diffstat (limited to 'newlib/libc/stdio/puts.c')
-rw-r--r-- | newlib/libc/stdio/puts.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/newlib/libc/stdio/puts.c b/newlib/libc/stdio/puts.c index 0c6740a14..7b8b34b01 100644 --- a/newlib/libc/stdio/puts.c +++ b/newlib/libc/stdio/puts.c @@ -82,6 +82,7 @@ _DEFUN(_puts_r, (ptr, s), size_t c = strlen (s); struct __suio uio; struct __siov iov[2]; + FILE *fp; iov[0].iov_base = s; iov[0].iov_len = c; @@ -92,11 +93,11 @@ _DEFUN(_puts_r, (ptr, s), uio.uio_iovcnt = 2; _REENT_SMALL_CHECK_INIT (ptr); - - _newlib_flockfile_start (_stdout_r (ptr)); - ORIENT (_stdout_r (ptr), -1); - result = (__sfvwrite_r (ptr, _stdout_r (ptr), &uio) ? EOF : '\n'); - _newlib_flockfile_start (_stdout_r (ptr)); + fp = _stdout_r (ptr); + _newlib_flockfile_start (fp); + ORIENT (fp, -1); + result = (__sfvwrite_r (ptr, fp, &uio) ? EOF : '\n'); + _newlib_flockfile_end (fp); return result; } |