diff options
author | Bastien Nocera <hadess@hadess.net> | 2022-07-22 11:09:15 +0200 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2022-07-22 11:16:50 +0200 |
commit | dd34d89b668254aa8b05192d396ab9f3069a0c28 (patch) | |
tree | 4fe978d9f30e1b490360d918dbf98717ae8780ff | |
parent | e4488b3ead25ea413a915085e911df5918233daa (diff) | |
download | accountsservice-dd34d89b668254aa8b05192d396ab9f3069a0c28.tar.gz |
util: Add locale verification function
Same as the XPG locale verification, but also considers empty strings as
valid locale, as this means "use the system value" in AccountsService.
-rw-r--r-- | src/util.c | 8 | ||||
-rw-r--r-- | src/util.h | 1 |
2 files changed, 9 insertions, 0 deletions
@@ -389,3 +389,11 @@ verify_xpg_locale (const char *locale) { return (explode_locale (locale, NULL, NULL, NULL, NULL) & COMPONENT_LANGUAGE); } + +gboolean +verify_locale (const char *locale) +{ + if (locale && *locale == '\0') + return TRUE; + return verify_xpg_locale (locale); +} @@ -44,6 +44,7 @@ gint get_user_groups (const gchar *username, gid_t **groups); gboolean verify_xpg_locale (const char *locale); +gboolean verify_locale (const char *locale); G_END_DECLS |