locale: make errors in writing files not critical

Suggested at https://github.com/systemd/systemd/pull/25805#discussion_r1054871210

> we now write multiple files and we cannot possibly guarantee that
> either both updates worked or neither. unix fs apis simply have
> no concept that would allow us to implement that. hence I think
> we should update what we can, log about what we cannot, but return
> success as long as our in-memory state was updated.
This commit is contained in:
Yu Watanabe
2023-01-23 11:30:03 +00:00
committed by Luca Boccassi
parent 4f34fd5d40
commit 50ec824570
+4 -8
View File
@@ -435,10 +435,8 @@ static int method_set_vc_keyboard(sd_bus_message *m, void *userdata, sd_bus_erro
}
r = vconsole_write_data(c);
if (r < 0) {
log_error_errno(r, "Failed to set virtual console keymap: %m");
return sd_bus_error_set_errnof(error, r, "Failed to set virtual console keymap: %m");
}
if (r < 0)
log_warning_errno(r, "Failed to write virtual console keymap, ignoring: %m");
if (convert) {
r = x11_write_data(c);
@@ -646,10 +644,8 @@ static int method_set_x11_keyboard(sd_bus_message *m, void *userdata, sd_bus_err
}
r = x11_write_data(c);
if (r < 0) {
log_error_errno(r, "Failed to set X11 keyboard layout: %m");
return sd_bus_error_set_errnof(error, r, "Failed to set X11 keyboard layout: %m");
}
if (r < 0)
log_warning_errno(r, "Failed to write X11 keyboard layout, ignoring: %m");
log_info("Changed X11 keyboard layout to '%s' model '%s' variant '%s' options '%s'",
strempty(in.layout),