Skip to content
Snippets Groups Projects
Commit 669f657f authored by Nadav Har'El's avatar Nadav Har'El Committed by Pekka Enberg
Browse files

Don't abort() on unknown locale


When an application attempts to use an unknown locale, don't abort but
rather fail normally, as Linux does on an unknown locale.

Theoretically, Posix specifies newlocale() can also fail with EINVAL if
the category_mask is malformed. However, the only reasonable usage of this
function we support is when base=NULL (or "C" locale) and locale is again
"C", and then we just ignore the category_mask. If that is not the case,
we can just complain with ENOENT (meaning we couldn't find the named
locale).

In any case, callers like std::locale() don't actually care why newlocale()
failed, and anyway assume a failure means the localename wasn't recognized.

Reviewed-by: default avatarRaphael S. Carvalho <raphaelsc@cloudius-systems.com>
Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
parent 35a40cee
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment