mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-22 05:33:45 -04:00
main: Graceful fallback if user has configured an invalid locale
This commit is contained in:
parent
3b9aca6a3d
commit
7bb5c80d04
1 changed files with 7 additions and 2 deletions
9
main.c
9
main.c
|
|
@ -433,8 +433,13 @@ main(int argc, char *const *argv)
|
||||||
|
|
||||||
const char *locale = setlocale(LC_CTYPE, "");
|
const char *locale = setlocale(LC_CTYPE, "");
|
||||||
if (locale == NULL) {
|
if (locale == NULL) {
|
||||||
LOG_ERR("setlocale() failed");
|
/*
|
||||||
return ret;
|
* If the user has configured an invalid locale, or a name of a locale
|
||||||
|
* that does not exist on this system, then the above call may return
|
||||||
|
* NULL. We should just continue with the fallback method below.
|
||||||
|
*/
|
||||||
|
LOG_WARN("setlocale() failed");
|
||||||
|
locale = "C";
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INFO("locale: %s", locale);
|
LOG_INFO("locale: %s", locale);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue