[newlib-cygwin/cygwin-3_6-branch] getlocalename_l: fix return value in LC_GLOBAL_LOCALE case

Corinna Vinschen corinna@sourceware.org
Mon Mar 24 20:59:10 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=fb277a97b4805f4c04ab8b2316c2624b4d031115

commit fb277a97b4805f4c04ab8b2316c2624b4d031115
Author:     Corinna Vinschen <corinna@vinschen.de>
AuthorDate: Mon Mar 24 19:52:57 2025 +0100
Commit:     Corinna Vinschen <corinna@vinschen.de>
CommitDate: Mon Mar 24 21:50:08 2025 +0100

    getlocalename_l: fix return value in LC_GLOBAL_LOCALE case
    
    The data was written to the per-reent getlocalename buffer,
    but the value wasn't returned.
    
    Fixes: 71511d4ac868 ("getlocalename_l: implement per SUS Base Specifications Issue 8 draft")
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
    
    (cherry picked from commit 6a6bf01b75d3b0a9188442ad62992003b756cdf6)

Diff:
---
 newlib/libc/locale/getlocalename_l.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/newlib/libc/locale/getlocalename_l.c b/newlib/libc/locale/getlocalename_l.c
index 7060c8df5952..1233bd98f06e 100644
--- a/newlib/libc/locale/getlocalename_l.c
+++ b/newlib/libc/locale/getlocalename_l.c
@@ -63,8 +63,8 @@ _getlocalename_l_r (struct _reent *ptr, int category, struct __locale_t *locobj)
       /* getlocalename_l is supposed to return the value in a
 	 thread-safe manner.  This requires to copy over the
 	 category string into thread-local storage. */
-      strcpy (_REENT_GETLOCALENAME_L_BUF (ptr),
-	      __get_global_locale ()->categories[category]);
+      return strcpy (_REENT_GETLOCALENAME_L_BUF (ptr),
+		     __get_global_locale ()->categories[category]);
     }
   return locobj->categories[category];
 #endif


More information about the Newlib-cvs mailing list