diff options
author | Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | 2009-07-08 07:50:40 +0000 |
---|---|---|
committer | Austin Yuan <shengquan.yuan@intel.com> | 2009-07-08 17:06:30 +0800 |
commit | a2080b8710711332e4c492b8c19f528a18e8647e (patch) | |
tree | d9d31c49e1ce445c3844dadeaed5f8bfd4c88be4 | |
parent | 6f6eabaf89974eef96d9f0ae26b472f9b06e14d3 (diff) | |
download | libva-a2080b8710711332e4c492b8c19f528a18e8647e.tar.gz |
Fix va_DisplayContextGetDriverName() to check for LIBVA_DRIVER_NAME first.
Signed-off-by: Austin Yuan <shengquan.yuan@intel.com>
-rw-r--r-- | src/x11/va_x11.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/src/x11/va_x11.c b/src/x11/va_x11.c index 1e53401..cfb88be 100644 --- a/src/x11/va_x11.c +++ b/src/x11/va_x11.c @@ -206,30 +206,23 @@ static VAStatus va_DisplayContextGetDriverName ( int driver_minor; int driver_patch; Bool result = True; - char *x_driver_name = NULL; + char *driver_name_env; if (driver_name) *driver_name = NULL; - - vaStatus = va_DRI2GetDriverName(pDisplayContext, driver_name); - if (vaStatus != VA_STATUS_SUCCESS) - vaStatus = va_DRIGetDriverName(pDisplayContext, driver_name); - if ((vaStatus == VA_STATUS_SUCCESS) + if ((driver_name_env = getenv("LIBVA_DRIVER_NAME")) != NULL && geteuid() == getuid()) { /* don't allow setuid apps to use LIBVA_DRIVER_NAME */ - if (getenv("LIBVA_DRIVER_NAME")) - { - /* For easier debugging */ - if (*driver_name) - XFree(*driver_name); - - *driver_name = strdup(getenv("LIBVA_DRIVER_NAME")); - return VA_STATUS_SUCCESS; - } + *driver_name = strdup(driver_name_env); + return VA_STATUS_SUCCESS; } - + + vaStatus = va_DRI2GetDriverName(pDisplayContext, driver_name); + if (vaStatus != VA_STATUS_SUCCESS) + vaStatus = va_DRIGetDriverName(pDisplayContext, driver_name); + return vaStatus; } |