]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
locale: decouple vconsole_read_data() from x11_read_data()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 28 Jan 2023 06:01:38 +0000 (15:01 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 28 Jan 2023 06:05:55 +0000 (15:05 +0900)
Let's make library-functions simple and independent as possible as they
are. No functional change, just refactoring.

src/locale/localed-util.c
src/locale/localed.c

index 2d5d76e7418c7c00868ce4c6a8efb2cf79a436d5..54e32e2e1cb4f934c2d65cdbb6367f42b6fe69c2 100644 (file)
@@ -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)
index b8031300f19f6cb79449bd9d4f6562756691faca..7355b2d0e2ce5b739551a147ee216dba692f06f9 100644 (file)
@@ -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");