diff options
author | tnurnberg@mysql.com/salvation.intern.azundris.com <> | 2006-07-14 12:50:00 +0200 |
---|---|---|
committer | tnurnberg@mysql.com/salvation.intern.azundris.com <> | 2006-07-14 12:50:00 +0200 |
commit | 00ec3973f72d80966e134d1d4bf521f8dcf02ea2 (patch) | |
tree | 2f8b1b724c97e3e08f91e1d928cd3541bf946359 /client/mysqldump.c | |
parent | b05cd027466749654e9431a1100bb44264136c64 (diff) | |
download | mariadb-git-00ec3973f72d80966e134d1d4bf521f8dcf02ea2.tar.gz |
Bug#21014: Segmentation fault of mysqldump on view
mysqldump did not select the correct database before trying to dump
views from it. this resulted in an empty result set, which in turn
startled mysql-dump into a core-dump. this only happened for views,
not for tables, and was only visible with multiple databases that
weren't by sheer luck in the order mysqldump required, anyway. this
fixes by selecting the correct database before dumping views; it also
catches the empty set-condition if it should occur for other reasons.
Diffstat (limited to 'client/mysqldump.c')
-rw-r--r-- | client/mysqldump.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/client/mysqldump.c b/client/mysqldump.c index 53cb06be6f3..9469815bfaf 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -2781,6 +2781,12 @@ static my_bool dump_all_views_in_db(char *database) uint numrows; char table_buff[NAME_LEN*2+3]; + if (mysql_select_db(sock, database)) + { + DB_error(sock, "when selecting the database"); + return 1; + } + if (opt_xml) print_xml_tag1(md_result_file, "", "database name=", database, "\n"); if (lock_tables) @@ -3436,12 +3442,13 @@ static my_bool get_view_structure(char *table, char* db) mysql_free_result(table_res); /* Get the result from "select ... information_schema" */ - if (!(table_res= mysql_store_result(sock))) + if (!(table_res= mysql_store_result(sock)) || + !(row= mysql_fetch_row(table_res))) { safe_exit(EX_MYSQLERR); DBUG_RETURN(1); } - row= mysql_fetch_row(table_res); + lengths= mysql_fetch_lengths(table_res); /* |