[PATCH weston 14/21] compositor-fbdev: MAP_FAILED is not NULL

Pekka Paalanen ppaalanen at gmail.com
Fri Sep 22 14:31:22 UTC 2017

From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>

Fix the assumption that MAP_FAILED would be equal to NULL. It is not.
Set 'fb' explicitly to NULL on mmap failure so that comparisons to NULL
would produce the expected result.

Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
 libweston/compositor-fbdev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index 281e39b9..402648d0 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -381,6 +381,7 @@ fbdev_frame_buffer_map(struct fbdev_output *output, int fd)
 	if (output->fb == MAP_FAILED) {
 		weston_log("Failed to mmap frame buffer: %s\n",
+		output->fb = NULL;
 		goto out_close;

More information about the wayland-devel mailing list