diff options
Diffstat (limited to 'newlib/libc/include/sys/stdio.h')
-rw-r--r-- | newlib/libc/include/sys/stdio.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/newlib/libc/include/sys/stdio.h b/newlib/libc/include/sys/stdio.h index c0cf33893..fa9cd5d0a 100644 --- a/newlib/libc/include/sys/stdio.h +++ b/newlib/libc/include/sys/stdio.h @@ -5,10 +5,12 @@ #include <sys/reent.h> /* Internal locking macros, used to protect stdio functions. In the - general case, expand to nothing. */ + general case, expand to nothing. Use __SSTR flag in FILE _flags to + detect if FILE is private to sprintf/sscanf class of functions; if + set then do nothing as lock is not initialised. */ #if !defined(_flockfile) #ifndef __SINGLE_THREAD__ -# define _flockfile(fp) __lock_acquire_recursive(fp->_lock) +# define _flockfile(fp) (((fp)->_flags & __SSTR) ? 0 : __lock_acquire_recursive((fp)->_lock)) #else # define _flockfile(fp) #endif @@ -16,7 +18,7 @@ #if !defined(_funlockfile) #ifndef __SINGLE_THREAD__ -# define _funlockfile(fp) __lock_release_recursive(fp->_lock) +# define _funlockfile(fp) (((fp)->_flags & __SSTR) ? 0 : __lock_release_recursive((fp)->_lock)) #else # define _funlockfile(fp) #endif |