X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flocale%2Flocaled.c;h=d6ffe67520506dea260f1ceadaba063a2ec0607f;hb=faec72d5dedae93f43c2dd624de1392ed9bacd80;hp=e3061c8d5ea46ea6187c790f519f4ce6d2bd619b;hpb=19befb2d5fc087f96e40ddc432b2cc9385666209;p=elogind.git diff --git a/src/locale/localed.c b/src/locale/localed.c index e3061c8d5..d6ffe6752 100644 --- a/src/locale/localed.c +++ b/src/locale/localed.c @@ -38,6 +38,7 @@ #include "bus-error.h" #include "bus-message.h" #include "event-util.h" +#include "locale-util.h" enum { /* We don't list LC_ALL here on purpose. People should be @@ -288,7 +289,7 @@ static int locale_write_data(Context *c) { int r, p; char **l = NULL; - r = load_env_file("/etc/locale.conf", NULL, &l); + r = load_env_file(NULL, "/etc/locale.conf", NULL, &l); if (r < 0 && r != -ENOENT) return r; @@ -393,7 +394,7 @@ static int vconsole_write_data(Context *c) { int r; _cleanup_strv_free_ char **l = NULL; - r = load_env_file("/etc/vconsole.conf", NULL, &l); + r = load_env_file(NULL, "/etc/vconsole.conf", NULL, &l); if (r < 0 && r != -ENOENT) return r; @@ -712,15 +713,16 @@ static int find_legacy_keymap(Context *c, char **new_keymap) { } } - if (matching > 0 && - streq_ptr(c->x11_model, a[2])) { - matching++; - - if (streq_ptr(c->x11_variant, a[3])) { + if (matching > 0) { + if (isempty(c->x11_model) || streq_ptr(c->x11_model, a[2])) { matching++; - if (streq_ptr(c->x11_options, a[4])) + if (streq_ptr(c->x11_variant, a[3])) { matching++; + + if (streq_ptr(c->x11_options, a[4])) + matching++; + } } } @@ -847,7 +849,7 @@ static int method_set_locale(sd_bus *bus, sd_bus_message *m, void *userdata, sd_ k = strlen(names[p]); if (startswith(*i, names[p]) && (*i)[k] == '=' && - string_is_safe((*i) + k + 1)) { + locale_is_valid((*i) + k + 1)) { valid = true; passed[p] = true;