summaryrefslogtreecommitdiff
path: root/storage/myisam/mi_dynrec.c
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@mysql.com>2009-11-11 01:10:30 +0400
committerAlexey Botchkov <holyfoot@mysql.com>2009-11-11 01:10:30 +0400
commitc868e89f82ffbaa2ec624e39294a48867da392c8 (patch)
tree88786b46d2536dff7741947d446380f532dcd91b /storage/myisam/mi_dynrec.c
parent6388a13230af3b9cfb59287a947f32b977d2538e (diff)
downloadmariadb-git-c868e89f82ffbaa2ec624e39294a48867da392c8.tar.gz
Bug #47139 Test "merge" crashes in "embedded" run
In fact this crashes in normal (not embedded) run also. The problem is in the memory mapping. Handling the ha_myisammrg::extra(MMAP) the MERGE engine tries to mmap all the tables it unites. Though some can be empty and then in the mi_dynmap_file() we call the my_mmap(0). Normally this call returns MAP_FAILED, but not on FreeBSD. There it returns like a 'normal' value, and after the consequitive munmap systems gets unstable and crashes on some system call later. per-file comments: storage/myisam/mi_dynrec.c Bug #47139 Test "merge" crashes in "embedded" run don't try to mmap zero-length area, just return at once.
Diffstat (limited to 'storage/myisam/mi_dynrec.c')
-rw-r--r--storage/myisam/mi_dynrec.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/storage/myisam/mi_dynrec.c b/storage/myisam/mi_dynrec.c
index 696b9ff93df..79f1ea0e4e5 100644
--- a/storage/myisam/mi_dynrec.c
+++ b/storage/myisam/mi_dynrec.c
@@ -66,9 +66,12 @@ static int _mi_cmp_buffer(File file, const uchar *buff, my_off_t filepos,
my_bool mi_dynmap_file(MI_INFO *info, my_off_t size)
{
DBUG_ENTER("mi_dynmap_file");
- if (size > (my_off_t) (~((size_t) 0)))
+ if (size == 0 || size > (my_off_t) (~((size_t) 0)))
{
- DBUG_PRINT("warning", ("File is too large for mmap"));
+ if (size)
+ DBUG_PRINT("warning", ("File is too large for mmap"));
+ else
+ DBUG_PRINT("warning", ("Do not mmap zero-length"));
DBUG_RETURN(1);
}
/*