Mesa (master): glx: Fix error message when no driverName is available

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 4 22:40:17 UTC 2019


Module: Mesa
Branch: master
Commit: 04e8ff85959278748b76877ad23d838c87d01919
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=04e8ff85959278748b76877ad23d838c87d01919

Author: Caio Marcelo de Oliveira Filho <caio.oliveira at intel.com>
Date:   Tue Jun  4 15:23:41 2019 -0700

glx: Fix error message when no driverName is available

Just provide a "(null)" literal in case driverName is NULL.

  In file included from ../src/glx/dri3_glx.c:76:
  ../src/glx/dri3_glx.c: In function ‘dri3_create_screen’:
  ../src/glx/dri_common.h:70:36: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
     70 | #define CriticalErrorMessageF(...) dri_message(_LOADER_FATAL, __VA_ARGS__)
        |                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ../src/glx/dri3_glx.c:1002:4: note: in expansion of macro ‘CriticalErrorMessageF’
   1002 |    CriticalErrorMessageF("failed to load driver: %s\n", driverName);
        |    ^~~~~~~~~~~~~~~~~~~~~
  ../src/glx/dri3_glx.c:1002:50: note: format string is defined here
   1002 |    CriticalErrorMessageF("failed to load driver: %s\n", driverName);
        |                                                  ^~
  cc1: some warnings being treated as errors

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/glx/dri3_glx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
index 8d5b9c2051e..796fc26d9dd 100644
--- a/src/glx/dri3_glx.c
+++ b/src/glx/dri3_glx.c
@@ -999,7 +999,7 @@ dri3_create_screen(int screen, struct glx_display * priv)
    return &psc->base;
 
 handle_error:
-   CriticalErrorMessageF("failed to load driver: %s\n", driverName);
+   CriticalErrorMessageF("failed to load driver: %s\n", driverName ? driverName : "(null)");
 
    if (configs)
        glx_config_destroy_list(configs);




More information about the mesa-commit mailing list