summaryrefslogtreecommitdiffstats
path: root/newlib/libc/stdio/vfprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/stdio/vfprintf.c')
-rw-r--r--newlib/libc/stdio/vfprintf.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/newlib/libc/stdio/vfprintf.c b/newlib/libc/stdio/vfprintf.c
index c13a7f70f..5fe443138 100644
--- a/newlib/libc/stdio/vfprintf.c
+++ b/newlib/libc/stdio/vfprintf.c
@@ -253,7 +253,7 @@ __sbprintf(fp, fmt, ap)
fake._bf._size = fake._w = sizeof(buf);
fake._lbfsize = 0; /* not actually used, but Just In Case */
#ifndef __SINGLE_THREAD__
- memset (&fake._lock, 0, sizeof(fake._lock));
+ __lock_init_recursive (*(_LOCK_RECURSIVE_T *)&fake._lock);
#endif
/* do the work, then copy any error status */
@@ -262,6 +262,10 @@ __sbprintf(fp, fmt, ap)
ret = EOF;
if (fake._flags & __SERR)
fp->_flags |= __SERR;
+
+#ifndef __SINGLE_THREAD__
+ __lock_close_recursive (*(_LOCK_RECURSIVE_T *)&fake._lock);
+#endif
return (ret);
}