summaryrefslogtreecommitdiff
path: root/unittest
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 /unittest
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 'unittest')
-rw-r--r--unittest/mysys/my_vsnprintf-t.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/unittest/mysys/my_vsnprintf-t.c b/unittest/mysys/my_vsnprintf-t.c
index 4ef6c310c8f..e7f37774f85 100644
--- a/unittest/mysys/my_vsnprintf-t.c
+++ b/unittest/mysys/my_vsnprintf-t.c
@@ -31,7 +31,7 @@ void test1(const char *res, const char *fmt, ...)
int main(void)
{
- plan(54);
+ plan(58);
test1("Constant string",
"Constant string");
@@ -44,6 +44,8 @@ int main(void)
"Format specifier c %c", '!');
test1("Format specifier d 1",
"Format specifier d %d", 1);
+ test1("Format specifier i 1",
+ "Format specifier i %i", 1);
test1("Format specifier u 2",
"Format specifier u %u", 2);
test1("Format specifier o 375",
@@ -77,6 +79,9 @@ int main(void)
test1("Length modifiers work: 1 * -1 * 2 * 3",
"Length modifiers work: %d * %ld * %lld * %zd", 1, -1L, 2LL, (size_t)3);
+ test1("Length modifiers work: 1 * -1 * 2 * 3",
+ "Length modifiers work: %i * %li * %lli * %zd", 1, -1L, 2LL, (size_t)3);
+
test1("long long X: 123456789abcdef0",
"long long X: %llx", 0x123456789abcdef0LL);
@@ -121,6 +126,10 @@ int main(void)
"Hello int, %d", 1);
test1("Hello int, -1",
"Hello int, %d", -1);
+ test1("Hello int, 1",
+ "Hello int, %i", 1);
+ test1("Hello int, -1",
+ "Hello int, %i", -1);
test1("Hello string 'I am a string'",
"Hello string '%s'", "I am a string");
test1("Hello hack hack hack hack hack hack hack 1",