diff --git a/newlib/ChangeLog b/newlib/ChangeLog index d7d9230f8..1043f89ee 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,8 @@ +2012-12-18 Corinna Vinschen + + * libc/stdio/puts.c (_puts_r): Fix typo in previous patch. Add local + variable fp for better readability. + 2012-12-17 Jeff Johnston * libc/stdio/puts.c: Add fp locking and use _stdout_r macro 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; }