X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flocale%2Flocaled.c;h=df812ee651ea1f71a36c3ecb48c85058665f94ce;hb=f73141d7657b3f60b8669bc8386413d8a8a372c6;hp=04268a19821f1559ea4cc4665ffa596e890aff91;hpb=0b507b17a760b21e33fc52ff377db6aa5086c680;p=elogind.git diff --git a/src/locale/localed.c b/src/locale/localed.c index 04268a198..df812ee65 100644 --- a/src/locale/localed.c +++ b/src/locale/localed.c @@ -31,6 +31,10 @@ #include "dbus-common.h" #include "polkit.h" #include "def.h" +#include "env-util.h" +#include "fileio.h" +#include "fileio-label.h" +#include "label.h" #define INTERFACE \ " \n" \ @@ -351,7 +355,7 @@ static int write_data_locale(void) { int r, p; char **l = NULL; - r = load_env_file("/etc/locale.conf", &l); + r = load_env_file("/etc/locale.conf", NULL, &l); if (r < 0 && r != -ENOENT) return r; @@ -389,7 +393,7 @@ static int write_data_locale(void) { return 0; } - r = write_env_file("/etc/locale.conf", l); + r = write_env_file_label("/etc/locale.conf", l); strv_free(l); return r; @@ -490,7 +494,7 @@ static int write_data_vconsole(void) { int r; char **l = NULL; - r = load_env_file("/etc/vconsole.conf", &l); + r = load_env_file("/etc/vconsole.conf", NULL, &l); if (r < 0 && r != -ENOENT) return r; @@ -545,7 +549,7 @@ static int write_data_vconsole(void) { return 0; } - r = write_env_file("/etc/vconsole.conf", l); + r = write_env_file_label("/etc/vconsole.conf", l); strv_free(l); return r; @@ -567,7 +571,7 @@ static int write_data_x11(void) { return 0; } - mkdir_parents_label("/etc/X11/xorg.conf.d", 0755); + mkdir_p_label("/etc/X11/xorg.conf.d", 0755); r = fopen_temporary("/etc/X11/xorg.conf.d/00-keyboard.conf", &f, &temp_path); if (r < 0) @@ -853,7 +857,7 @@ static int convert_x11_to_vconsole(DBusConnection *connection) { * layout stripped off. */ if (x > 0 && strlen(a[1]) == x && - strncmp(state.x11_layout, a[1], x) == 0) + strneq(state.x11_layout, a[1], x)) matching = 5; else { size_t w; @@ -1273,7 +1277,7 @@ static DBusHandlerResult locale_message_handler( if (!(reply = dbus_message_new_method_return(message))) goto oom; - if (!dbus_connection_send(connection, reply, NULL)) + if (!bus_maybe_send_reply(connection, message, reply)) goto oom; dbus_message_unref(reply); @@ -1363,7 +1367,7 @@ int main(int argc, char *argv[]) { log_set_target(LOG_TARGET_AUTO); log_parse_environment(); log_open(); - + label_init("/etc"); umask(0022); if (argc == 2 && streq(argv[1], "--introspect")) {