summaryrefslogtreecommitdiff
path: root/dbug
diff options
context:
space:
mode:
authorOlav Sandstaa <olav.sandstaa@oracle.com>2010-09-15 13:33:22 +0200
committerOlav Sandstaa <olav.sandstaa@oracle.com>2010-09-15 13:33:22 +0200
commit93e7e5f9d94c10f94f5d19ae10ebe9adcf443e78 (patch)
treeb1c96012cdcd3f151fdcf0ddb95a5ba3154fcb52 /dbug
parent3e70a34f3002befed25439603a2df1a039c4cc91 (diff)
downloadmariadb-git-93e7e5f9d94c10f94f5d19ae10ebe9adcf443e78.tar.gz
Fix for Bug#54478 "mysqld crashes during boot when running mtr with --debug option"
The crash during boot was caused by a DBUG_PRINT statement in fill_schema_schemata() (in sql_show.cc). This DBUG_PRINT statement contained several instances of %s in the format string and for one of these we gave a NULL pointer as the argument. This caused the call to vsnprintf() to crash when running on Solaris. The fix for this problem is to replace the call to vsnprintf() with my_vsnprintf() which handles that a NULL pointer is passed as argumens for %s. This patch also extends my_vsnprintf() to support %i in the format string.
Diffstat (limited to 'dbug')
-rw-r--r--dbug/dbug.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/dbug/dbug.c b/dbug/dbug.c
index fd87669b8ca..4968d9e0568 100644
--- a/dbug/dbug.c
+++ b/dbug/dbug.c
@@ -1335,15 +1335,11 @@ void _db_doprnt_(const char *format,...)
* This function is intended as a
* vfprintf clone with consistent, platform independent output for
* problematic formats like %p, %zd and %lld.
- * However: full functionality for my_vsnprintf has not been backported yet,
- * so code using "%g" or "%f" will have undefined behaviour.
*/
static void DbugVfprintf(FILE *stream, const char* format, va_list args)
{
char cvtbuf[1024];
- size_t len;
- /* Do not use my_vsnprintf, it does not support "%g". */
- len = vsnprintf(cvtbuf, sizeof(cvtbuf), format, args);
+ (void) my_vsnprintf(cvtbuf, sizeof(cvtbuf), format, args);
(void) fprintf(stream, "%s\n", cvtbuf);
}