diff options
author | Olav Sandstaa <olav.sandstaa@oracle.com> | 2010-09-15 13:33:22 +0200 |
---|---|---|
committer | Olav Sandstaa <olav.sandstaa@oracle.com> | 2010-09-15 13:33:22 +0200 |
commit | 77844bd10b50fbe08565eb0f7ebbcdaf9a1eab3c (patch) | |
tree | b1c96012cdcd3f151fdcf0ddb95a5ba3154fcb52 /unittest/mysys | |
parent | 5b9a2f3b6958aef95505d34648de33c9fe26eb8e (diff) | |
download | mariadb-git-77844bd10b50fbe08565eb0f7ebbcdaf9a1eab3c.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.
dbug/dbug.c:
Replace the use of vsnprintf() with my_vsnprintf(). On some platforms
vsnprintf() did not handle that a NULL pointer was given as an argument
for a %s in the format string.
include/mysql/service_my_snprintf.h:
Add support for %i in format string to my_vsnprintf().
strings/my_vsnprintf.c:
Add support for %i in format string to my_vsnprintf().
unittest/mysys/my_vsnprintf-t.c:
Add unit tests for %i in format string to my_vsnprintf().
Diffstat (limited to 'unittest/mysys')
-rw-r--r-- | unittest/mysys/my_vsnprintf-t.c | 11 |
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", |