summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
Diffstat (limited to 'myisam')
-rw-r--r--myisam/mi_close.c9
-rw-r--r--myisam/mi_info.c4
2 files changed, 9 insertions, 4 deletions
diff --git a/myisam/mi_close.c b/myisam/mi_close.c
index 059e7d3223a..f30119144bc 100644
--- a/myisam/mi_close.c
+++ b/myisam/mi_close.c
@@ -65,8 +65,13 @@ int mi_close(register MI_INFO *info)
share->temporary ? FLUSH_IGNORE_CHANGED :
FLUSH_RELEASE))
error=my_errno;
- if (share->kfile >= 0 && my_close(share->kfile,MYF(0)))
- error = my_errno;
+ if (share->kfile >= 0)
+ {
+ if (share->mode != O_RDONLY && mi_is_crashed(info))
+ mi_state_info_write(share->kfile, &share->state, 1);
+ if (my_close(share->kfile,MYF(0)))
+ error = my_errno;
+ }
#ifdef HAVE_MMAP
if (share->file_map)
_mi_unmap_file(info);
diff --git a/myisam/mi_info.c b/myisam/mi_info.c
index 078ce4042e8..6e7abfc0914 100644
--- a/myisam/mi_info.c
+++ b/myisam/mi_info.c
@@ -59,8 +59,8 @@ int mi_status(MI_INFO *info, register MI_ISAMINFO *x, uint flag)
x->keys = share->state.header.keys;
x->check_time = share->state.check_time;
x->mean_reclength = info->state->records ?
- (ulong) (info->state->data_file_length-info->state->empty)/
- info->state->records : (ulong) share->min_pack_length;
+ (ulong) ((info->state->data_file_length-info->state->empty)/
+ info->state->records) : (ulong) share->min_pack_length;
}
if (flag & HA_STATUS_ERRKEY)
{