]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/locale/localed-util.c
Merge pull request #25602 from fbuihuu/fix-TEST-73-LOCALE
[thirdparty/systemd.git] / src / locale / localed-util.c
index 598e89591c04d4e6af3877d3b4bc5543b9b6c769..8fb65b96997d1ac202e8712c4ca4b76ec974fbd9 100644 (file)
@@ -254,7 +254,7 @@ int vconsole_write_data(Context *c) {
 
 int x11_write_data(Context *c) {
         _cleanup_fclose_ FILE *f = NULL;
-        _cleanup_free_ char *temp_path = NULL;
+        _cleanup_(unlink_and_freep) char *temp_path = NULL;
         struct stat st;
         int r;
 
@@ -300,23 +300,15 @@ int x11_write_data(Context *c) {
 
         r = fflush_sync_and_check(f);
         if (r < 0)
-                goto fail;
+                return r;
 
-        if (rename(temp_path, "/etc/X11/xorg.conf.d/00-keyboard.conf") < 0) {
-                r = -errno;
-                goto fail;
-        }
+        if (rename(temp_path, "/etc/X11/xorg.conf.d/00-keyboard.conf") < 0)
+                return -errno;
 
         if (stat("/etc/X11/xorg.conf.d/00-keyboard.conf", &st) >= 0)
                 c->x11_mtime = timespec_load(&st.st_mtim);
 
         return 0;
-
-fail:
-        if (temp_path)
-                (void) unlink(temp_path);
-
-        return r;
 }
 
 static int read_next_mapping(const char* filename,
@@ -432,7 +424,6 @@ int vconsole_convert_to_x11(Context *c) {
 }
 
 int find_converted_keymap(const char *x11_layout, const char *x11_variant, char **new_keymap) {
-        const char *dir;
         _cleanup_free_ char *n = NULL;
 
         if (x11_variant)
@@ -746,7 +737,7 @@ int locale_gen_enable_locale(const char *locale) {
                         return r;
                 r = copy_xattr(fileno(fr), fileno(fw), COPY_ALL_XATTRS);
                 if (r < 0)
-                        return r;
+                        log_debug_errno(r, "Failed to copy all xattrs from old to new /etc/locale.gen file, ignoring: %m");
         }
 
         if (!write_new) {