aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2023-03-24 10:51:31 +0100
committerCorinna Vinschen <corinna@vinschen.de>2023-03-24 12:44:52 +0100
commit606373e7d2e7009209ca536ab1c9c3393af61275 (patch)
treef77a8139112675d7c8a8b4fdbb27da471f6c4b4c /newlib/libc
parent87ab6c7b26bf3c925183d7e439985db070b03b39 (diff)
downloadnewlib-606373e7d2e7009209ca536ab1c9c3393af61275.zip
newlib-606373e7d2e7009209ca536ab1c9c3393af61275.tar.gz
newlib-606373e7d2e7009209ca536ab1c9c3393af61275.tar.bz2
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/libc')
-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 08f29db..278f78e 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. */