diff options
author | Dylan Baker <[email protected]> | 2014-07-22 11:43:54 -0700 |
---|---|---|
committer | Jordan Justen <[email protected]> | 2014-07-24 23:15:06 -0700 |
commit | bf1247936a5c4efd7f7f081b9f9c2a2afba0310f (patch) | |
tree | 2e7de331db2a0da5304d30ec8c5de01d3859a148 | |
parent | cce58147eb1450a26c03756af37da52d180580c4 (diff) |
gbm: Search LIBGL_DRIVERS_PATH if GBM_DRIVERS_PATH is not set
The GBM_DRIVERS_PATH environment variable is not documented, and only
used to set the location of gbm drivers, while LIBGL_DRIVERS_PATH is
used for everything else, and is documented.
Generally this split leads to confusion as to why gbm doesn't work.
This patch will read LIBGL_DRIVERS_PATH as a fallback if
GBM_DRIVERS_PATH is not set.
The comments clearly indicate that using LIBGL_DRIVERS_PATH is
preferred over GBM_DRIVERS_PATH.
v2: - Use GBM_DRIVERS_PATH as a fallback
v3: [[email protected]] - Make LIBGL_DRIVERS_PATH the fallback
Signed-off-by: Dylan Baker <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>
Reviewed-by: Kristian Høgsberg <[email protected]>
-rw-r--r-- | src/gbm/backends/dri/gbm_dri.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c index 347bc997f4a..47e62f3caca 100644 --- a/src/gbm/backends/dri/gbm_dri.c +++ b/src/gbm/backends/dri/gbm_dri.c @@ -211,9 +211,19 @@ dri_load_driver(struct gbm_dri_device *dri) char *get_extensions_name; search_paths = NULL; + /* don't allow setuid apps to use LIBGL_DRIVERS_PATH or GBM_DRIVERS_PATH */ if (geteuid() == getuid()) { - /* don't allow setuid apps to use GBM_DRIVERS_PATH */ + /* Read GBM_DRIVERS_PATH first for compatibility, but LIBGL_DRIVERS_PATH + * is recommended over GBM_DRIVERS_PATH. + */ search_paths = getenv("GBM_DRIVERS_PATH"); + + /* Read LIBGL_DRIVERS_PATH if GBM_DRIVERS_PATH was not set. + * LIBGL_DRIVERS_PATH is recommended over GBM_DRIVERS_PATH. + */ + if (search_paths == NULL) { + search_paths = getenv("LIBGL_DRIVERS_PATH"); + } } if (search_paths == NULL) search_paths = DEFAULT_DRIVER_DIR; |