summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/egl/main/egldriver.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c
index 8e623a071e0..d58991aa4c4 100644
--- a/src/egl/main/egldriver.c
+++ b/src/egl/main/egldriver.c
@@ -347,9 +347,11 @@ _eglPreloadPattern(const char *dir, size_t len, void *preload_data)
if (strncmp(dirent->d_name, prefix, prefix_len) != 0)
continue;
/* match the suffix */
- p = dirent->d_name + dirent_len - suffix_len;
- if (p < dirent->d_name || strcmp(p, suffix) != 0)
- continue;
+ if (suffix) {
+ p = dirent->d_name + dirent_len - suffix_len;
+ if (p < dirent->d_name || strcmp(p, suffix) != 0)
+ continue;
+ }
/* make a full path and load the driver */
if (len + dirent_len + 1 <= sizeof(path)) {