wayland/display: Fix mmap use

> From version 7 onwards, the fd must be mapped with MAP_PRIVATE by the recipient, as MAP_SHARED may fail.

 - https://wayland.freedesktop.org/docs/html/apa.html#protocol-spec-wl_keyboard

Signed-off-by: Samuel Dionne-Riel <samuel@dionne-riel.com>
This commit is contained in:
Samuel Dionne-Riel
2024-05-04 21:52:20 -04:00
committed by lbonn
parent 51dec9d65b
commit b04bedca44

View File

@@ -347,7 +347,7 @@ static void wayland_keyboard_keymap(void *data, struct wl_keyboard *keyboard,
return;
}
char *str = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
char *str = mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);
if (str == MAP_FAILED) {
close(fd);
return;