X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fegl%2Fmain%2Fegllog.c;h=babab07d8ebc0a234a717ca7ba498e8f19155cab;hb=1499619fe6815510d4448f0e297d097f20a0acf3;hp=11a9bf7275cd3dcf76bb34a50003318b3ec75d4d;hpb=46a784b7fd2dcab97c26d5ca02fb8f74945ba157;p=mesa.git diff --git a/src/egl/main/egllog.c b/src/egl/main/egllog.c index 11a9bf7275c..babab07d8eb 100644 --- a/src/egl/main/egllog.c +++ b/src/egl/main/egllog.c @@ -1,3 +1,33 @@ +/************************************************************************** + * + * Copyright 2008 VMware, Inc. + * Copyright 2009-2010 Chia-I Wu + * Copyright 2010 LunarG, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + /** * Logging facility for debug/info messages. * _EGL_FATAL messages are printed to stderr @@ -8,9 +38,9 @@ #include #include #include -#include #include "egllog.h" +#include "eglstring.h" #include "eglmutex.h" #define MAXSTRING 1000 @@ -116,7 +146,7 @@ _eglInitLogger(void) log_env = getenv("EGL_LOG_LEVEL"); if (log_env) { for (i = 0; level_strings[i]; i++) { - if (strcasecmp(log_env, level_strings[i]) == 0) { + if (_eglstrcasecmp(log_env, level_strings[i]) == 0) { level = i; break; } @@ -150,6 +180,7 @@ _eglLog(EGLint level, const char *fmtStr, ...) { va_list args; char msg[MAXSTRING]; + int ret; /* one-time initialization; a little race here is fine */ if (!logging.initialized) @@ -161,7 +192,9 @@ _eglLog(EGLint level, const char *fmtStr, ...) if (logging.logger) { va_start(args, fmtStr); - vsnprintf(msg, MAXSTRING, fmtStr, args); + ret = vsnprintf(msg, MAXSTRING, fmtStr, args); + if (ret < 0 || ret >= MAXSTRING) + strcpy(msg, ""); va_end(args); logging.logger(level, msg);