From 189cacabe9a8cfb6acf04dd9c9c525fdd88e7294 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sat, 28 Jan 2023 15:01:38 +0900 Subject: [PATCH] locale: decouple vconsole_read_data() from x11_read_data() Let's make library-functions simple and independent as possible as they are. No functional change, just refactoring. --- src/locale/localed-util.c | 4 ---- src/locale/localed.c | 10 ++++++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/locale/localed-util.c b/src/locale/localed-util.c index 2d5d76e7418..54e32e2e1cb 100644 --- a/src/locale/localed-util.c +++ b/src/locale/localed-util.c @@ -325,10 +325,6 @@ int x11_read_data(Context *c, sd_bus_message *m) { assert(c); - r = vconsole_read_data(c, m); - if (r < 0) - return r; - /* Do not try to re-read the file within single bus operation. */ if (m) { if (m == c->x11_cache) diff --git a/src/locale/localed.c b/src/locale/localed.c index b8031300f19..7355b2d0e2c 100644 --- a/src/locale/localed.c +++ b/src/locale/localed.c @@ -140,6 +140,10 @@ static int property_get_xkb( assert(property); + r = vconsole_read_data(c, reply); + if (r < 0) + return r; + r = x11_read_data(c, reply); if (r < 0) return r; @@ -613,6 +617,12 @@ static int method_set_x11_keyboard(sd_bus_message *m, void *userdata, sd_bus_err return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Specified keymap cannot be compiled, refusing as invalid."); } + r = vconsole_read_data(c, m); + if (r < 0) { + log_error_errno(r, "Failed to read virtual console keymap data: %m"); + return sd_bus_error_set_errnof(error, r, "Failed to read virtual console keymap data: %m"); + } + r = x11_read_data(c, m); if (r < 0) { log_error_errno(r, "Failed to read x11 keyboard layout data: %m");