From bee7ea68c0d17fb66884f9639c882bffbccc1be0 Mon Sep 17 00:00:00 2001 From: Vasiliy Ulyanov Date: Tue, 9 Jun 2015 18:35:09 +0300 Subject: YaGL: Fix yagl_get_gles2_sym(...) resolution order dlsym(NULL, ...) may return a valid pointer to a local symbol. We need to search it in libGLESv2 explicitly first. Change-Id: I6200679d7b69444798d3feeb77b685e2772eb3a7 Signed-off-by: Vasiliy Ulyanov --- EGL/yagl_egl_state.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/EGL/yagl_egl_state.c b/EGL/yagl_egl_state.c index 2d96afc..096dca9 100644 --- a/EGL/yagl_egl_state.c +++ b/EGL/yagl_egl_state.c @@ -82,11 +82,7 @@ void *yagl_get_gles1_sym(const char *name) void *yagl_get_gles2_sym(const char *name) { void *handle; - void *sym = dlsym(NULL, name); - - if (sym) { - return sym; - } + void *sym = NULL; handle = dlopen("libGLESv2.so.1", RTLD_NOW|RTLD_GLOBAL); if (!handle) { @@ -94,10 +90,14 @@ void *yagl_get_gles2_sym(const char *name) } if (handle) { - return dlsym(handle, name); + sym = dlsym(handle, name); } - return NULL; + if (!sym) { + sym = dlsym(NULL, name); + } + + return sym; } static void yagl_egl_state_free(void* ptr) -- cgit v1.2.3