KMSDRM: fix compilation on linux, no d_namlen (Bug 4624)
authorSylvain Becker <sylvain.becker@gmail.com>
Wed, 19 Jun 2019 09:16:53 +0200
changeset 12890dd47d4ea431e
parent 12889 32d98e72ed94
child 12891 df4fda4ec707
KMSDRM: fix compilation on linux, no d_namlen (Bug 4624)
src/video/kmsdrm/SDL_kmsdrmvideo.c
     1.1 --- a/src/video/kmsdrm/SDL_kmsdrmvideo.c	Wed Jun 19 00:52:34 2019 -0400
     1.2 +++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c	Wed Jun 19 09:16:53 2019 +0200
     1.3 @@ -101,7 +101,11 @@
     1.4      folder = opendir(KMSDRM_DRI_PATH);
     1.5      if (folder) {
     1.6          while ((res = readdir(folder))) {
     1.7 -            if (res->d_namlen > 4 && strncmp(res->d_name, "card", 4)) {
     1.8 +            int len = 0;
     1.9 +            if (res->d_name) {
    1.10 +                len = SDL_strlen(res->d_name);
    1.11 +            }
    1.12 +            if (len > 4 && strncmp(res->d_name, "card", 4)) {
    1.13                  devcount++;
    1.14              }
    1.15          }