mirror of
https://github.com/jjsullivan5196/wvkbd.git
synced 2025-03-14 03:12:47 +01:00
fix incorrect keymap size and trailing 0 bytes when setting keymap
Ref: https://github.com/jjsullivan5196/wvkbd/issues/35 Signed-off-by: Anjandev Momi <anjan@momi.ca>
This commit is contained in:
parent
98e6c43d54
commit
83edf203a7
@ -515,9 +515,10 @@ create_and_upload_keymap(struct kbd *kb, const char *name, uint32_t comp_unichr,
|
|||||||
exit(9);
|
exit(9);
|
||||||
}
|
}
|
||||||
const char *keymap_template = keymaps[keymap_index];
|
const char *keymap_template = keymaps[keymap_index];
|
||||||
const size_t keymap_size = strlen(keymap_template) + 64;
|
size_t keymap_size = strlen(keymap_template) + 64;
|
||||||
char *keymap_str = malloc(keymap_size);
|
char *keymap_str = malloc(keymap_size);
|
||||||
sprintf(keymap_str, keymap_template, comp_unichr, comp_shift_unichr);
|
sprintf(keymap_str, keymap_template, comp_unichr, comp_shift_unichr);
|
||||||
|
keymap_size = strlen(keymap_str);
|
||||||
int keymap_fd = os_create_anonymous_file(keymap_size);
|
int keymap_fd = os_create_anonymous_file(keymap_size);
|
||||||
if (keymap_fd < 0) {
|
if (keymap_fd < 0) {
|
||||||
die("could not create keymap fd\n");
|
die("could not create keymap fd\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user