summaryrefslogtreecommitdiffstats
path: root/newlib
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2012-12-17 22:44:09 +0000
committerJeff Johnston <jjohnstn@redhat.com>2012-12-17 22:44:09 +0000
commit0a95d80385577a26d6bfcf431b86e7be6fae29e3 (patch)
tree9a4b52f5b72659deaeee57ca9d6b045220ebb950 /newlib
parent3c90302d41f972220f0fb404b7726f5981d12361 (diff)
downloadcygnal-0a95d80385577a26d6bfcf431b86e7be6fae29e3.tar.gz
cygnal-0a95d80385577a26d6bfcf431b86e7be6fae29e3.tar.bz2
cygnal-0a95d80385577a26d6bfcf431b86e7be6fae29e3.zip
2012-12-17 Jeff Johnston <jjohnstn@redhat.com>
* libc/stdio/puts.c: Add fp locking and use _stdout_r macro to refer to the stream rather than stdout.
Diffstat (limited to 'newlib')
-rw-r--r--newlib/ChangeLog5
-rw-r--r--newlib/libc/stdio/puts.c10
2 files changed, 13 insertions, 2 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index a2a2b9000..d7d9230f8 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -1,3 +1,8 @@
+2012-12-17 Jeff Johnston <jjohnstn@redhat.com>
+
+ * libc/stdio/puts.c: Add fp locking and use _stdout_r macro
+ to refer to the stream rather than stdout.
+
2012-12-14 Yufeng Zhang <yufeng.zhang@arm.com>
* libc/machine/aarch64/machine/_types.h: New file; define _ssize_t
diff --git a/newlib/libc/stdio/puts.c b/newlib/libc/stdio/puts.c
index 66291cd13..0c6740a14 100644
--- a/newlib/libc/stdio/puts.c
+++ b/newlib/libc/stdio/puts.c
@@ -78,6 +78,7 @@ _DEFUN(_puts_r, (ptr, s),
struct _reent *ptr _AND
_CONST char * s)
{
+ int result;
size_t c = strlen (s);
struct __suio uio;
struct __siov iov[2];
@@ -89,9 +90,14 @@ _DEFUN(_puts_r, (ptr, s),
uio.uio_resid = c + 1;
uio.uio_iov = &iov[0];
uio.uio_iovcnt = 2;
+
_REENT_SMALL_CHECK_INIT (ptr);
- ORIENT (stdout, -1);
- return (__sfvwrite_r (ptr, _stdout_r (ptr), &uio) ? EOF : '\n');
+
+ _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));
+ return result;
}
#ifndef _REENT_ONLY