From 181ba13b23e966df7ebe3c74e95ae0bc475444c5 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Thu, 2 Feb 2023 03:17:06 +0900 Subject: [PATCH 1/2] locale: fix ENOENT handling for vconsole.conf or xorg.conf --- src/locale/localed-util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/locale/localed-util.c b/src/locale/localed-util.c index a64adcd9ca..3c260d86bd 100644 --- a/src/locale/localed-util.c +++ b/src/locale/localed-util.c @@ -291,6 +291,7 @@ int vconsole_read_data(Context *c, sd_bus_message *m) { if (fd == -ENOENT) { c->vc_stat = (struct stat) {}; vc_context_clear(&c->vc); + x11_context_clear(&c->x11_from_vc); return 0; } if (fd < 0) @@ -337,7 +338,7 @@ int x11_read_data(Context *c, sd_bus_message *m) { fd = RET_NERRNO(open("/etc/X11/xorg.conf.d/00-keyboard.conf", O_CLOEXEC | O_PATH)); if (fd == -ENOENT) { c->x11_stat = (struct stat) {}; - context_clear_x11(c); + x11_context_clear(&c->x11_from_xorg); return 0; } if (fd < 0) From c4abc558908d0621ffedc19782e5625567188f28 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Thu, 2 Feb 2023 03:17:53 +0900 Subject: [PATCH 2/2] locale: drop context_clear_x11() It is used at only place, and mostly trivial. No functional change, just refactoring. --- src/locale/localed-util.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/locale/localed-util.c b/src/locale/localed-util.c index 3c260d86bd..8f18ecd0d2 100644 --- a/src/locale/localed-util.c +++ b/src/locale/localed-util.c @@ -154,13 +154,6 @@ int x11_context_copy(X11Context *dest, const X11Context *src) { return modified; } -static void context_clear_x11(Context *c) { - assert(c); - - x11_context_clear(&c->x11_from_xorg); - x11_context_clear(&c->x11_from_vc); -} - void vc_context_clear(VCContext *vc) { assert(vc); @@ -235,7 +228,8 @@ void context_clear(Context *c) { assert(c); locale_context_clear(&c->locale_context); - context_clear_x11(c); + x11_context_clear(&c->x11_from_xorg); + x11_context_clear(&c->x11_from_vc); vc_context_clear(&c->vc); c->locale_cache = sd_bus_message_unref(c->locale_cache);