summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/egl/drivers/dri2/platform_wayland.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index 8122c811288..b05f5363163 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -1133,7 +1133,14 @@ drm_handle_device(void *data, struct wl_drm *drm, const char *device)
if (drmGetNodeTypeFromFd(dri2_dpy->fd) == DRM_NODE_RENDER) {
dri2_dpy->authenticated = true;
} else {
- drmGetMagic(dri2_dpy->fd, &magic);
+ if (drmGetMagic(dri2_dpy->fd, &magic)) {
+ close(dri2_dpy->fd);
+ dri2_dpy->fd = -1;
+ free(dri2_dpy->device_name);
+ dri2_dpy->device_name = NULL:
+ _eglLog(_EGL_WARNING, "wayland-egl: drmGetMagic failed");
+ return;
+ }
wl_drm_authenticate(dri2_dpy->wl_drm, magic);
}
}