summaryrefslogtreecommitdiff
path: root/rcm-server-main.c
diff options
context:
space:
mode:
Diffstat (limited to 'rcm-server-main.c')
-rw-r--r--rcm-server-main.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/rcm-server-main.c b/rcm-server-main.c
index 0623a01..cde13a0 100644
--- a/rcm-server-main.c
+++ b/rcm-server-main.c
@@ -587,29 +587,30 @@ method_setkeymap(sd_bus_message *m, void *userdata, sd_bus_error *error)
new_keymap->layout = zmalloc(sizeof(struct keycode *) * cols * rows);
if (!new_keymap->layout) {
- keymap_free(new_keymap);
r = -ENOMEM;
goto out;
}
r = method_setkeymap_parse_dbus_msg(m, new_keymap, NULL, NULL, NULL, NULL);
- if (r < 0) {
- keymap_free(new_keymap);
+ if (r < 0)
goto out;
- }
printf("\tUpdated keymap: name (%s), desc (%s), keycodes(%u), rows(%u), cols(%u)\n",
new_keymap->name, new_keymap->description,
new_keymap->keycode_count,
new_keymap->rows, new_keymap->cols);
- /* FIXME: Write to disk */
+ r = keymap_write(new_keymap);
+ if (r < 0)
+ goto out;
+
list_replace(&old_keymap->list, &new_keymap->list);
keymap_free(old_keymap);
return sd_bus_reply_method_return(m, NULL);
out:
+ keymap_free(new_keymap);
return sd_bus_error_set_errno(error, r);
}