svnno****@sourc*****
svnno****@sourc*****
2008年 2月 12日 (火) 10:48:14 JST
Revision: 106 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=tritonn&view=rev&rev=106 Author: mir Date: 2008-02-12 10:48:14 +0900 (Tue, 12 Feb 2008) Log Message: ----------- Bugfix: mi_rename caused crash because of illegal memory access. (Thanks to Kazuho Oku.) Modified Paths: -------------- tags/tritonn-1.1.0-mysql-5.0.51a/myisam/mi_rename.c Modified: tags/tritonn-1.1.0-mysql-5.0.51a/myisam/mi_rename.c =================================================================== --- tags/tritonn-1.1.0-mysql-5.0.51a/myisam/mi_rename.c 2008-02-12 01:48:00 UTC (rev 105) +++ tags/tritonn-1.1.0-mysql-5.0.51a/myisam/mi_rename.c 2008-02-12 01:48:14 UTC (rev 106) @@ -47,28 +47,25 @@ #ifdef ENABLE_SENNA /* nkjm modified 2007/06/04 SFID:10291 */ { - int i, keys; + int i, j; MI_INFO *mi_info; - MI_INFO cp_of_mi_info; - + int senna_indexes[MAX_INDEXES]; + if (!(mi_info = mi_open(old_name, O_RDONLY, 0))) { SEN_LOG(sen_log_warning, "mi_rename => cannot get MI_INFO"); DBUG_RETURN(my_errno); } - - cp_of_mi_info = *mi_info; + for (i = 0, j = 0; i < mi_info->s->base.keys; i++) + if (mi_info->s->keyinfo[i].senna) + senna_indexes[j++] = i; mi_close(mi_info); - keys = cp_of_mi_info.s->base.keys; - for (i = 0; i < keys; i++) + for (i = 0; i < j; i++) { - if (cp_of_mi_info.s->keyinfo[i].senna) - { - my_snprintf(from, FN_REFLEN, "%s.%03d", old_name, i); - my_snprintf(to, FN_REFLEN, "%s.%03d", new_name, i); - SEN_LOG(sen_log_notice, "mi_rename => sen_index_rename: from=%s, to=%s", from, to); - sen_index_rename(from, to); - } + my_snprintf(from, FN_REFLEN, "%s.%03d", old_name, senna_indexes[i]); + my_snprintf(to, FN_REFLEN, "%s.%03d", new_name, senna_indexes[i]); + SEN_LOG(sen_log_notice, "mi_rename => sen_index_rename: from=%s, to=%s", from, to); + sen_index_rename(from, to); } } #endif /* ENABLE_SENNA */