summaryrefslogtreecommitdiff
path: root/src/locale
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-11-23 06:12:55 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-11-23 06:22:30 +0900
commitaf7865c1b7298f531070ca02281408b52b4c5df2 (patch)
tree657caa93ce69f2112d909a613dea0148c40a0f6d /src/locale
parent6804d7a849612eb470397aa4f4aae46865bfdb92 (diff)
downloadsystemd-af7865c1b7298f531070ca02281408b52b4c5df2.tar.gz
locale: store polkit_registry in Context
Diffstat (limited to 'src/locale')
-rw-r--r--src/locale/keymap-util.c3
-rw-r--r--src/locale/keymap-util.h3
-rw-r--r--src/locale/localed.c10
3 files changed, 9 insertions, 7 deletions
diff --git a/src/locale/keymap-util.c b/src/locale/keymap-util.c
index 495261f4d7..0bf62df22e 100644
--- a/src/locale/keymap-util.c
+++ b/src/locale/keymap-util.c
@@ -5,6 +5,7 @@
#include <string.h>
#include <unistd.h>
+#include "bus-util.h"
#include "def.h"
#include "env-util.h"
#include "fd-util.h"
@@ -76,6 +77,8 @@ void context_clear(Context *c) {
sd_bus_message_unref(c->locale_cache);
sd_bus_message_unref(c->x11_cache);
sd_bus_message_unref(c->vc_cache);
+
+ bus_verify_polkit_async_registry_free(c->polkit_registry);
};
void locale_simplify(char *locale[_VARIABLE_LC_MAX]) {
diff --git a/src/locale/keymap-util.h b/src/locale/keymap-util.h
index 278c74b2ba..6eced84240 100644
--- a/src/locale/keymap-util.h
+++ b/src/locale/keymap-util.h
@@ -3,6 +3,7 @@
#include "sd-bus.h"
+#include "hashmap.h"
#include "locale-util.h"
#include "time-util.h"
@@ -22,6 +23,8 @@ typedef struct Context {
usec_t vc_mtime;
char *vc_keymap;
char *vc_keymap_toggle;
+
+ Hashmap *polkit_registry;
} Context;
int find_converted_keymap(const char *x11_layout, const char *x11_variant, char **new_keymap);
diff --git a/src/locale/localed.c b/src/locale/localed.c
index b9dffeae5a..6174132a1d 100644
--- a/src/locale/localed.c
+++ b/src/locale/localed.c
@@ -26,8 +26,6 @@
#include "strv.h"
#include "user-util.h"
-static Hashmap *polkit_registry = NULL;
-
static int locale_update_system_manager(Context *c, sd_bus *bus) {
_cleanup_free_ char **l_unset = NULL;
_cleanup_strv_free_ char **l_set = NULL;
@@ -362,7 +360,7 @@ static int method_set_locale(sd_bus_message *m, void *userdata, sd_bus_error *er
NULL,
interactive,
UID_INVALID,
- &polkit_registry,
+ &c->polkit_registry,
error);
if (r < 0)
return r;
@@ -433,7 +431,7 @@ static int method_set_vc_keyboard(sd_bus_message *m, void *userdata, sd_bus_erro
NULL,
interactive,
UID_INVALID,
- &polkit_registry,
+ &c->polkit_registry,
error);
if (r < 0)
return r;
@@ -626,7 +624,7 @@ static int method_set_x11_keyboard(sd_bus_message *m, void *userdata, sd_bus_err
NULL,
interactive,
UID_INVALID,
- &polkit_registry,
+ &c->polkit_registry,
error);
if (r < 0)
return r;
@@ -762,7 +760,5 @@ int main(int argc, char *argv[]) {
log_error_errno(r, "Failed to run event loop: %m");
finish:
- bus_verify_polkit_async_registry_free(polkit_registry);
-
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
}