Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/newlib
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2023-03-24 12:51:31 +0300
committerCorinna Vinschen <corinna@vinschen.de>2023-03-24 14:44:52 +0300
commit606373e7d2e7009209ca536ab1c9c3393af61275 (patch)
treef77a8139112675d7c8a8b4fdbb27da471f6c4b4c /newlib
parent87ab6c7b26bf3c925183d7e439985db070b03b39 (diff)
newlocale: set errno to ENOENT if __loadlocale fails
__loadlocale never sets errno, but newlocale is supposed to return ENOENT if the locale isn't valid. Fixes: aefd8b5b518b ("Implement newlocale, freelocale, duplocale, uselocale") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'newlib')
-rw-r--r--newlib/libc/locale/newlocale.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/newlib/libc/locale/newlocale.c b/newlib/libc/locale/newlocale.c
index 08f29dbcc..278f78ed2 100644
--- a/newlib/libc/locale/newlocale.c
+++ b/newlib/libc/locale/newlocale.c
@@ -171,7 +171,10 @@ _newlocale_r (struct _reent *p, int category_mask, const char *locale,
continue;
/* Otherwise load locale data. */
else if (!__loadlocale (&tmp_locale, i, new_categories[i]))
- goto error;
+ {
+ p->_errno = ENOENT;
+ goto error;
+ }
}
}
/* Allocate new locale_t. */