meta-st-stm32mp/recipes-graphics/wayland/weston/0005-clients-close-unused-k...

75 lines
2.1 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From dc6538a73577ee23841ea3c5150b3907a7cef04a Mon Sep 17 00:00:00 2001
From: Antonio Borneo <borneo.antonio@gmail.com>
Date: Mon, 29 Apr 2019 17:54:10 +0200
Subject: [PATCH] clients: close unused keymap fd
commit 4071225cdc12a36a08ddd3102a3dd17d4006c320 upstream.
In the simple examples in which keymap is not handled, the open
descriptor has to be properly closed.
After each suspend/resume sequence the keymap is send again to
every client. On client weston-simple-egl the leak causes a
segfault when no more file descriptors can be opened.
Close the file descriptor and lazily copy/paste the comment
already available in simple-dmabuf-v4l.
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
---
clients/multi-resource.c | 2 ++
clients/simple-egl.c | 2 ++
clients/weston-info.c | 3 +++
3 files changed, 7 insertions(+)
diff --git a/clients/multi-resource.c b/clients/multi-resource.c
index 2be0a7e3..0a035118 100644
--- a/clients/multi-resource.c
+++ b/clients/multi-resource.c
@@ -296,6 +296,8 @@ static void
keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard,
uint32_t format, int fd, uint32_t size)
{
+ /* Just so we dont leak the keymap fd */
+ close(fd);
}
static void
diff --git a/clients/simple-egl.c b/clients/simple-egl.c
index a1e57aef..ac99b449 100644
--- a/clients/simple-egl.c
+++ b/clients/simple-egl.c
@@ -695,6 +695,8 @@ static void
keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard,
uint32_t format, int fd, uint32_t size)
{
+ /* Just so we dont leak the keymap fd */
+ close(fd);
}
static void
diff --git a/clients/weston-info.c b/clients/weston-info.c
index 609e270a..20c96d0f 100644
--- a/clients/weston-info.c
+++ b/clients/weston-info.c
@@ -32,6 +32,7 @@
#include <time.h>
#include <assert.h>
#include <ctype.h>
+#include <unistd.h>
#include <wayland-client.h>
@@ -435,6 +436,8 @@ static void
keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard,
uint32_t format, int fd, uint32_t size)
{
+ /* Just so we dont leak the keymap fd */
+ close(fd);
}
static void
--
2.21.0