public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Fix _REENT_EMERGENCY() if TLS is enabled
@ 2023-04-26 9:56 Sebastian Huber
0 siblings, 0 replies; only message in thread
From: Sebastian Huber @ 2023-04-26 9:56 UTC (permalink / raw)
To: newlib-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=e301a74a6f111df4553b50b813a589589d1708b1
commit e301a74a6f111df4553b50b813a589589d1708b1
Author: Sebastian Huber <sebastian.huber@embedded-brains.de>
Date: Wed Apr 26 08:23:04 2023 +0200
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.
Diff:
---
newlib/libc/include/sys/reent.h | 2 +-
newlib/libc/stdio/tmpnam.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h
index 6d8b005b2..c71f75dbc 100644
--- a/newlib/libc/include/sys/reent.h
+++ b/newlib/libc/include/sys/reent.h
@@ -812,7 +812,7 @@ extern _Thread_local int _tls_cvtlen;
#define _REENT_CVTLEN(_ptr) (_tls_cvtlen)
extern _Thread_local void (*_tls_cleanup)(struct _reent *);
#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)
extern _Thread_local int _tls_errno;
#define _REENT_ERRNO(_ptr) (_tls_errno)
diff --git a/newlib/libc/stdio/tmpnam.c b/newlib/libc/stdio/tmpnam.c
index 51dfd1cea..dc04cf3f6 100644
--- a/newlib/libc/stdio/tmpnam.c
+++ b/newlib/libc/stdio/tmpnam.c
@@ -84,7 +84,7 @@ The global pointer <<environ>> is also required.
#ifdef _REENT_THREAD_LOCAL
_Thread_local int _tls_inc;
-_Thread_local char _tls_emergency;
+_Thread_local char _tls_emergency[_REENT_EMERGENCY_SIZE];
#endif
/* Try to open the file specified, if it can't be opened then try
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-04-26 9:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-26 9:56 [newlib-cygwin] Fix _REENT_EMERGENCY() if TLS is enabled Sebastian Huber
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).