X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flocale%2Flocaled.c;h=22950a60a988db33db185e1aa38cce5c7503d8ef;hb=8caf9d6836c3ed5b7bb4c1ea8dea5241a634c298;hp=d46d91e032d5fb05730dcc3eb708bf73fe990299;hpb=d200735e13c52dcfe36c0e066f9f6c2fbfb85a9c;p=elogind.git diff --git a/src/locale/localed.c b/src/locale/localed.c index d46d91e03..22950a60a 100644 --- a/src/locale/localed.c +++ b/src/locale/localed.c @@ -6,16 +6,16 @@ Copyright 2011 Lennart Poettering systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. systemd is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with systemd; If not, see . ***/ @@ -26,6 +26,7 @@ #include #include "util.h" +#include "mkdir.h" #include "strv.h" #include "dbus-common.h" #include "polkit.h" @@ -424,7 +425,7 @@ static void push_data(DBusConnection *bus) { l_set = new0(char*, _PROP_MAX); l_unset = new0(char*, _PROP_MAX); if (!l_set || !l_unset) { - log_error("Out of memory"); + log_oom(); goto finish; } @@ -437,7 +438,7 @@ static void push_data(DBusConnection *bus) { char *s; if (asprintf(&s, "%s=%s", names[p], data[p]) < 0) { - log_error("Out of memory"); + log_oom(); goto finish; } @@ -455,30 +456,30 @@ static void push_data(DBusConnection *bus) { dbus_message_iter_init_append(m, &iter); if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "s", &sub)) { - log_error("Out of memory."); + log_oom(); goto finish; } STRV_FOREACH(t, l_unset) if (!dbus_message_iter_append_basic(&sub, DBUS_TYPE_STRING, t)) { - log_error("Out of memory."); + log_oom(); goto finish; } if (!dbus_message_iter_close_container(&iter, &sub) || !dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "s", &sub)) { - log_error("Out of memory."); + log_oom(); goto finish; } STRV_FOREACH(t, l_set) if (!dbus_message_iter_append_basic(&sub, DBUS_TYPE_STRING, t)) { - log_error("Out of memory."); + log_oom(); goto finish; } if (!dbus_message_iter_close_container(&iter, &sub)) { - log_error("Out of memory."); + log_oom(); goto finish; } @@ -590,7 +591,7 @@ static int write_data_x11(void) { return 0; } - mkdir_parents("/etc/X11/xorg.conf.d", 0755); + mkdir_parents_label("/etc/X11/xorg.conf.d", 0755); r = fopen_temporary("/etc/X11/xorg.conf.d/00-keyboard.conf", &f, &temp_path); if (r < 0) @@ -1100,7 +1101,7 @@ static DBusHandlerResult locale_message_handler( if (modified) { - r = verify_polkit(connection, message, "org.freedesktop.locale1.set-locale", interactive, &error); + r = verify_polkit(connection, message, "org.freedesktop.locale1.set-locale", interactive, NULL, &error); if (r < 0) { strv_free(l); return bus_send_error_reply(connection, message, &error, r); @@ -1181,7 +1182,7 @@ static DBusHandlerResult locale_message_handler( if (!streq_ptr(keymap, state.vc_keymap) || !streq_ptr(keymap_toggle, state.vc_keymap_toggle)) { - r = verify_polkit(connection, message, "org.freedesktop.locale1.set-keyboard", interactive, &error); + r = verify_polkit(connection, message, "org.freedesktop.locale1.set-keyboard", interactive, NULL, &error); if (r < 0) return bus_send_error_reply(connection, message, &error, r); @@ -1251,7 +1252,7 @@ static DBusHandlerResult locale_message_handler( !streq_ptr(variant, state.x11_variant) || !streq_ptr(options, state.x11_options)) { - r = verify_polkit(connection, message, "org.freedesktop.locale1.set-keyboard", interactive, &error); + r = verify_polkit(connection, message, "org.freedesktop.locale1.set-keyboard", interactive, NULL, &error); if (r < 0) return bus_send_error_reply(connection, message, &error, r); @@ -1343,8 +1344,7 @@ static int connect_bus(DBusConnection **_bus) { if (!dbus_connection_register_object_path(bus, "/org/freedesktop/locale1", &locale_vtable, NULL) || !dbus_connection_add_filter(bus, bus_exit_idle_filter, &remain_until, NULL)) { - log_error("Not enough memory"); - r = -ENOMEM; + r = log_oom(); goto fail; }