Fix _REENT_EMERGENCY() if TLS is enabled

If the thread-local storage (TLS) support was enabled, the _REENT_EMERGENCY()
object had the wrong size.  It must be a buffer of length _REENT_EMERGENCY_SIZE
and not just a single character.
This commit is contained in:
Sebastian Huber 2023-04-26 08:23:04 +02:00
parent c3798a2f7d
commit e301a74a6f
2 changed files with 2 additions and 2 deletions

View File

@ -812,7 +812,7 @@ extern _Thread_local int _tls_cvtlen;
#define _REENT_CVTLEN(_ptr) (_tls_cvtlen) #define _REENT_CVTLEN(_ptr) (_tls_cvtlen)
extern _Thread_local void (*_tls_cleanup)(struct _reent *); extern _Thread_local void (*_tls_cleanup)(struct _reent *);
#define _REENT_CLEANUP(_ptr) (_tls_cleanup) #define _REENT_CLEANUP(_ptr) (_tls_cleanup)
extern _Thread_local char _tls_emergency; extern _Thread_local char _tls_emergency[_REENT_EMERGENCY_SIZE];
#define _REENT_EMERGENCY(_ptr) (_tls_emergency) #define _REENT_EMERGENCY(_ptr) (_tls_emergency)
extern _Thread_local int _tls_errno; extern _Thread_local int _tls_errno;
#define _REENT_ERRNO(_ptr) (_tls_errno) #define _REENT_ERRNO(_ptr) (_tls_errno)

View File

@ -84,7 +84,7 @@ The global pointer <<environ>> is also required.
#ifdef _REENT_THREAD_LOCAL #ifdef _REENT_THREAD_LOCAL
_Thread_local int _tls_inc; _Thread_local int _tls_inc;
_Thread_local char _tls_emergency; _Thread_local char _tls_emergency[_REENT_EMERGENCY_SIZE];
#endif #endif
/* Try to open the file specified, if it can't be opened then try /* Try to open the file specified, if it can't be opened then try