From 83095147802fd2c4da580667938362c28db9d844 Mon Sep 17 00:00:00 2001 From: Andrey Alekseenko Date: Sat, 11 Jan 2025 15:03:08 +0100 Subject: [PATCH] Fix read return value check in buffer_release_thread Previously, we were reading 0 bytes and were passing uninitiaized value to `switch`. Likely, not much changed in practice (all codepaths were just terminating the thread, regardless of the success of the `read`), but now we don't trigger undefined behavior. --- src/wayland-eglsurface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wayland-eglsurface.c b/src/wayland-eglsurface.c index 72c0863..e1da47a 100644 --- a/src/wayland-eglsurface.c +++ b/src/wayland-eglsurface.c @@ -500,7 +500,7 @@ buffer_release_thread(void *args) } if (pfds[1].revents & POLLIN) { - if (read(pfds[1].fd, &cmd, sizeof(cmd) != sizeof(cmd))) { + if (read(pfds[1].fd, &cmd, sizeof(cmd)) != sizeof(cmd)) { /* Reading an event from the app side failed. Bail. */ wl_display_cancel_read(wlDpy); return NULL;