public inbox for cygwin-cvs@sourceware.org help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org> To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin/main] Cygwin: locales: set errno to ENOENT if locale is invalid Date: Fri, 24 Mar 2023 11:52:12 +0000 (GMT) [thread overview] Message-ID: <20230324115212.03C1F384D169@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=c53d0910e611bf4cf61f8f8cb44c6ce70d3e9a05 commit c53d0910e611bf4cf61f8f8cb44c6ce70d3e9a05 Author: Corinna Vinschen <corinna@vinschen.de> AuthorDate: Fri Mar 24 12:42:34 2023 +0100 Commit: Corinna Vinschen <corinna@vinschen.de> CommitDate: Fri Mar 24 12:50:59 2023 +0100 Cygwin: locales: set errno to ENOENT if locale is invalid This allows newlocale to return with a valid errno if the locale is invalid. Fixes: e95a7a795522 ("Cygwin: convert Windows locale handling from LCID to ISO5646 strings") Signed-off-by: Corinna Vinschen <corinna@vinschen.de> Diff: --- winsup/cygwin/nlsfuncs.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/nlsfuncs.cc b/winsup/cygwin/nlsfuncs.cc index 808bf6a87320..a81dff3966d7 100644 --- a/winsup/cygwin/nlsfuncs.cc +++ b/winsup/cygwin/nlsfuncs.cc @@ -74,7 +74,10 @@ __get_rfc5646_from_locale (const char *name, wchar_t *win_locale) if (!wcscmp (locale, L"ber")) wcscpy (locale, L"tzm"); if (ResolveLocaleName (locale, wlocale, ENCODING_LEN + 1) <= 0) - return -1; + { + set_errno (ENOENT); + return -1; + } wcpcpy (win_locale, wlocale); return 1; } @@ -114,7 +117,10 @@ __get_rfc5646_from_locale (const char *name, wchar_t *win_locale) } if (!wlocale[0] && ResolveLocaleName (locale, wlocale, ENCODING_LEN + 1) <= 1) - return -1; + { + set_errno (ENOENT); + return -1; + } /* Check for modifiers changing the script */ const wchar_t *iso15924_script[] = { L"Latn-", L"Cyrl-", L"Deva-", L"Adlm-" };
reply other threads:[~2023-03-24 11:52 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230324115212.03C1F384D169@sourceware.org \ --to=corinna@sourceware.org \ --cc=cygwin-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).