X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Flocale%2Flocaled.c;h=23da149b0e18e137a9c2ac9b2268a074ab05c326;hp=65318b6067b6b2a6c8ab29ed37dbe5baed3e0649;hb=bce415edcae8e7af8327de8265d621f95fa5426f;hpb=29a07cdb4a317f2e1ea160b79bfe6eb1be2e6e01 diff --git a/src/locale/localed.c b/src/locale/localed.c index 65318b606..23da149b0 100644 --- a/src/locale/localed.c +++ b/src/locale/localed.c @@ -288,7 +288,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; @@ -366,11 +366,11 @@ static int locale_update_system_manager(Context *c, sd_bus *bus) { } assert(c_set + c_unset == _LOCALE_MAX); - r = sd_bus_message_new_method_call(bus, + r = sd_bus_message_new_method_call(bus, &m, "org.freedesktop.systemd1", "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", - "UnsetAndSetEnvironment", &m); + "UnsetAndSetEnvironment"); if (r < 0) return r; @@ -393,7 +393,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 +712,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++; + } } } @@ -948,7 +949,7 @@ static int method_set_vc_keyboard(sd_bus *bus, sd_bus_message *m, void *userdata if ((keymap && (!filename_is_safe(keymap) || !string_is_safe(keymap))) || (keymap_toggle && (!filename_is_safe(keymap_toggle) || !string_is_safe(keymap_toggle)))) - return sd_bus_error_set_errnof(error, r, "Received invalid keymap data: %s", -EINVAL); + return sd_bus_error_set_errnof(error, -EINVAL, "Received invalid keymap data"); r = bus_verify_polkit_async(bus, &c->polkit_registry, m, "org.freedesktop.locale1.set-keyboard", @@ -1020,7 +1021,7 @@ static int method_set_x11_keyboard(sd_bus *bus, sd_bus_message *m, void *userdat (model && !string_is_safe(model)) || (variant && !string_is_safe(variant)) || (options && !string_is_safe(options))) - return sd_bus_error_set_errnof(error, r, "Received invalid keyboard data: %s", -EINVAL); + return sd_bus_error_set_errnof(error, -EINVAL, "Received invalid keyboard data"); r = bus_verify_polkit_async(bus, &c->polkit_registry, m, "org.freedesktop.locale1.set-keyboard", @@ -1088,7 +1089,7 @@ static int connect_bus(Context *c, sd_event *event, sd_bus **_bus) { return r; } - r = sd_bus_add_object_vtable(bus, "/org/freedesktop/locale1", "org.freedesktop.locale1", locale_vtable, c); + r = sd_bus_add_object_vtable(bus, NULL, "/org/freedesktop/locale1", "org.freedesktop.locale1", locale_vtable, c); if (r < 0) { log_error("Failed to register object: %s", strerror(-r)); return r; @@ -1149,14 +1150,12 @@ int main(int argc, char *argv[]) { goto finish; } - r = bus_event_loop_with_idle(event, bus, "org.freedesktop.locale1", DEFAULT_EXIT_USEC); + r = bus_event_loop_with_idle(event, bus, "org.freedesktop.locale1", DEFAULT_EXIT_USEC, NULL, NULL); if (r < 0) { log_error("Failed to run event loop: %s", strerror(-r)); goto finish; } - r = 0; - finish: context_free(&context, bus);