Map keymap fd using MAP_PRIVATE as required by the spec

Also report failures
This commit is contained in:
Kovid Goyal 2024-04-05 13:10:04 +05:30
parent 676c426e87
commit 18b595a7e7
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

4
glfw/wl_init.c vendored
View file

@ -430,13 +430,15 @@ static void keyboardHandleKeymap(void* data UNUSED,
if (format != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1)
{
_glfwInputError(GLFW_PLATFORM_ERROR, "Unknown keymap format: %u", format);
close(fd);
return;
}
mapStr = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
mapStr = mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);
if (mapStr == MAP_FAILED) {
close(fd);
_glfwInputError(GLFW_PLATFORM_ERROR, "Mapping of keymap file descriptor failed: %u", format);
return;
}
glfw_xkb_compile_keymap(&_glfw.wl.xkb, mapStr);