diff options
author | unknown <monty@donna.mysql.com> | 2001-01-15 17:17:43 +0200 |
---|---|---|
committer | unknown <monty@donna.mysql.com> | 2001-01-15 17:17:43 +0200 |
commit | 4d37689abeeaacb662c31d58038d2386a5228f8f (patch) | |
tree | 4264a6499afeab1b99e53f927059e5450643a435 /myisam | |
parent | 4e264107df5c286d0a06ff28699aec398e36e684 (diff) | |
download | mariadb-git-4d37689abeeaacb662c31d58038d2386a5228f8f.tar.gz |
Fixed test when exeeding file quota on write
Sanity checks when opening MyISAM files
Docs/manual.texi:
Added information about Borland c++
myisam/mi_check.c:
Cleanup
myisam/mi_open.c:
Added sanity checking
myisam/myisamchk.c:
Better error messages
mysys/my_chsize.c:
Cleanup
mysys/my_seek.c:
Changed debug message
mysys/my_write.c:
Fixed test when exeeding file quota
Diffstat (limited to 'myisam')
-rw-r--r-- | myisam/mi_check.c | 2 | ||||
-rw-r--r-- | myisam/mi_open.c | 23 | ||||
-rw-r--r-- | myisam/myisamchk.c | 11 |
3 files changed, 24 insertions, 12 deletions
diff --git a/myisam/mi_check.c b/myisam/mi_check.c index b394fb25e97..67503bd4f6c 100644 --- a/myisam/mi_check.c +++ b/myisam/mi_check.c @@ -543,7 +543,7 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, if (next_page+info->s->blocksize > max_length) goto err; info->state->key_file_length=(max_length & - ~ (my_off_t) (info->s->blocksize-1)); + ~ (my_off_t) (info->s->blocksize-1)); } if (!_mi_fetch_keypage(info,keyinfo,next_page,temp_buff,0)) { diff --git a/myisam/mi_open.c b/myisam/mi_open.c index 2eab33228dc..0280355ae72 100644 --- a/myisam/mi_open.c +++ b/myisam/mi_open.c @@ -185,6 +185,22 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) HA_ERR_CRASHED_ON_REPAIR : HA_ERR_CRASHED_ON_USAGE); goto err; } + + /* sanity check */ + if (share->base.keystart > 65535 || share->base.rec_reflength > 8) + { + my_errno=HA_ERR_CRASHED; + goto err; + } + + if (share->base.max_key_length > MI_MAX_KEY_BUFF || keys > MI_MAX_KEY || + key_parts >= MI_MAX_KEY * MI_MAX_KEY_SEG) + { + DBUG_PRINT("error",("Wrong key info: Max_key_length: %d keys: %d key_parts: %d", share->base.max_key_length, keys, key_parts)); + my_errno=HA_ERR_UNSUPPORTED; + goto err; + } + /* Correct max_file_length based on length of sizeof_t */ max_data_file_length= (share->options & (HA_OPTION_PACK_RECORD | HA_OPTION_COMPRESS_RECORD)) ? @@ -220,13 +236,6 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) share->base.max_data_file_length=(my_off_t) max_data_file_length; share->base.max_key_file_length=(my_off_t) max_key_file_length; - if (share->base.max_key_length > MI_MAX_KEY_BUFF || keys > MI_MAX_KEY || - key_parts >= MI_MAX_KEY * MI_MAX_KEY_SEG) - { - DBUG_PRINT("error",("Wrong key info: Max_key_length: %d keys: %d key_parts: %d", share->base.max_key_length, keys, key_parts)); - my_errno=HA_ERR_UNSUPPORTED; - goto err; - } if (share->options & HA_OPTION_COMPRESS_RECORD) share->base.max_key_length+=2; /* For safety */ diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c index 0e6f5927a3a..8e794b7e708 100644 --- a/myisam/myisamchk.c +++ b/myisam/myisamchk.c @@ -200,7 +200,7 @@ static struct option long_options[] = static void print_version(void) { - printf("%s Ver 1.40 for %s at %s\n",my_progname,SYSTEM_TYPE, + printf("%s Ver 1.41 for %s at %s\n",my_progname,SYSTEM_TYPE, MACHINE_TYPE); } @@ -506,6 +506,8 @@ static int myisamchk(MI_CHECK *param, my_string filename) param->error_printed=1; switch (my_errno) { case HA_ERR_CRASHED: + mi_check_print_error(param,"'%s' doesn't have a correct index definition. You need to recreate it before you can do a repair",filename); + break; case HA_ERR_WRONG_TABLE_DEF: mi_check_print_error(param,"'%s' is not a MyISAM-table",filename); break; @@ -1205,9 +1207,10 @@ static int mi_sort_records(MI_CHECK *param, param->temp_filename); goto err; } - if (filecopy(param,new_file,info->dfile,0L,share->pack.header_length, - "datafile-header")) - goto err; + if (share->pack.header_length) + if (filecopy(param,new_file,info->dfile,0L,share->pack.header_length, + "datafile-header")) + goto err; info->rec_cache.file=new_file; /* Use this file for cacheing*/ lock_memory(param); |