summaryrefslogtreecommitdiff
path: root/src/locale
diff options
context:
space:
mode:
Diffstat (limited to 'src/locale')
-rw-r--r--src/locale/localectl.c6
-rw-r--r--src/locale/localed.c24
2 files changed, 20 insertions, 10 deletions
diff --git a/src/locale/localectl.c b/src/locale/localectl.c
index 3616f4af1f..1e06f2251c 100644
--- a/src/locale/localectl.c
+++ b/src/locale/localectl.c
@@ -467,9 +467,9 @@ static int list_x11_keymaps(sd_bus *bus, char **args, unsigned n) {
} else
*w = 0;
- r = strv_extend(&list, l);
- if (r < 0)
- return log_oom();
+ r = strv_extend(&list, l);
+ if (r < 0)
+ return log_oom();
}
if (strv_isempty(list)) {
diff --git a/src/locale/localed.c b/src/locale/localed.c
index 3b511bfaf4..cb4052fdd5 100644
--- a/src/locale/localed.c
+++ b/src/locale/localed.c
@@ -471,15 +471,25 @@ static int x11_write_data(Context *c) {
fprintf(f, " Option \"XkbOptions\" \"%s\"\n", c->x11_options);
fputs("EndSection\n", f);
- fflush(f);
- if (ferror(f) || rename(temp_path, "/etc/X11/xorg.conf.d/00-keyboard.conf") < 0) {
+ r = fflush_and_check(f);
+ if (r < 0)
+ goto fail;
+
+ if (rename(temp_path, "/etc/X11/xorg.conf.d/00-keyboard.conf") < 0) {
r = -errno;
- unlink("/etc/X11/xorg.conf.d/00-keyboard.conf");
- unlink(temp_path);
- return r;
- } else
- return 0;
+ goto fail;
+ }
+
+ return 0;
+
+fail:
+ (void) unlink("/etc/X11/xorg.conf.d/00-keyboard.conf");
+
+ if (temp_path)
+ (void) unlink(temp_path);
+
+ return r;
}
static int vconsole_reload(sd_bus *bus) {