From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1921) id E5C7E3858CDA; Wed, 26 Apr 2023 09:56:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E5C7E3858CDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1682502967; bh=t9TEPZdvQKGCU9saW5oYnYY38YFdkOKe/T6bUCa8cSA=; h=From:To:Subject:Date:From; b=Qm137QHiQ24kZaOE+oWcdQJu/ZLAQq4TaWNM0pQ6uv1QCbEHCAPdIW7R9cTqBRf/m +38EcWYKTjwsuPejlZYOVz3Pe+LNf/sCgeZTTccVum+Af0HeWL1tpi11Ifl4GrZ/Cx mBjZ+xQ2UIQLmd1NfEYew5oiqQs+W7I1tQVvizsQ= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Sebastian Huber To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] Fix _REENT_EMERGENCY() if TLS is enabled X-Act-Checkin: newlib-cygwin X-Git-Author: Sebastian Huber X-Git-Refname: refs/heads/master X-Git-Oldrev: c3798a2f7ddaedd91d5ea76a8adc5a4ee652cffd X-Git-Newrev: e301a74a6f111df4553b50b813a589589d1708b1 Message-Id: <20230426095606.E5C7E3858CDA@sourceware.org> Date: Wed, 26 Apr 2023 09:56:06 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3De301a74a6f1= 11df4553b50b813a589589d1708b1 commit e301a74a6f111df4553b50b813a589589d1708b1 Author: Sebastian Huber Date: Wed Apr 26 08:23:04 2023 +0200 Fix _REENT_EMERGENCY() if TLS is enabled =20 If the thread-local storage (TLS) support was enabled, the _REENT_EMERG= ENCY() object had the wrong size. It must be a buffer of length _REENT_EMERGE= NCY_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/reen= t.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 <> is also required. =20 #ifdef _REENT_THREAD_LOCAL _Thread_local int _tls_inc; -_Thread_local char _tls_emergency; +_Thread_local char _tls_emergency[_REENT_EMERGENCY_SIZE]; #endif =20 /* Try to open the file specified, if it can't be opened then try