From cbe80d47080f7e5b11d952e0978f9ca3b4bbb480 Mon Sep 17 00:00:00 2001 From: Sylvain Becker Date: Wed, 13 Mar 2019 14:54:51 +0100 Subject: [PATCH] KMSDRM: valid file descriptors could positive or 0. -1 is invalid. (Bug 4530) --- src/video/kmsdrm/SDL_kmsdrmvideo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c index eebd7e8e6..8562d35e1 100644 --- a/src/video/kmsdrm/SDL_kmsdrmvideo.c +++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c @@ -250,7 +250,7 @@ KMSDRM_FBDestroyCallback(struct gbm_bo *bo, void *data) { KMSDRM_FBInfo *fb_info = (KMSDRM_FBInfo *)data; - if (fb_info && fb_info->drm_fd > 0 && fb_info->fb_id != 0) { + if (fb_info && fb_info->drm_fd >= 0 && fb_info->fb_id != 0) { KMSDRM_drmModeRmFB(fb_info->drm_fd, fb_info->fb_id); SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Delete DRM FB %u", fb_info->fb_id); } @@ -552,7 +552,7 @@ KMSDRM_VideoQuit(_THIS) } if(vdata->saved_crtc != NULL) { - if(vdata->drm_fd > 0 && vdata->saved_conn_id > 0) { + if(vdata->drm_fd >= 0 && vdata->saved_conn_id > 0) { /* Restore saved CRTC settings */ drmModeCrtc *crtc = vdata->saved_crtc; if(KMSDRM_drmModeSetCrtc(vdata->drm_fd, crtc->crtc_id, crtc->buffer_id,