From 5998c51324112f9c534a0c1f9a8b96e66db272f8 Mon Sep 17 00:00:00 2001 From: Sylvain Becker Date: Wed, 19 Jun 2019 09:16:53 +0200 Subject: [PATCH] KMSDRM: fix compilation on linux, no d_namlen (Bug 4624) --- src/video/kmsdrm/SDL_kmsdrmvideo.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c index ea103cb31..b1a18acac 100644 --- a/src/video/kmsdrm/SDL_kmsdrmvideo.c +++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c @@ -101,7 +101,11 @@ static int get_dricount(void) folder = opendir(KMSDRM_DRI_PATH); if (folder) { while ((res = readdir(folder))) { - if (res->d_namlen > 4 && strncmp(res->d_name, "card", 4)) { + int len = 0; + if (res->d_name) { + len = SDL_strlen(res->d_name); + } + if (len > 4 && strncmp(res->d_name, "card", 4)) { devcount++; } }