summaryrefslogtreecommitdiff
path: root/storage/csv
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-05-12 16:52:09 +0200
committerSergei Golubchik <serg@mariadb.org>2017-05-15 22:23:10 +0200
commita65623b3eb2695069791aa21d278b8bc751a560e (patch)
treead75e96d5165f1ff7446b584f27ee248df248025 /storage/csv
parent71b45032421fe47fceabe419c63e79c44794428d (diff)
downloadmariadb-git-a65623b3eb2695069791aa21d278b8bc751a560e.tar.gz
MDEV-11883 MariaDB crashes with out-of-memory when query information_schema
CSV engine didn't expect CSM files to be read-only
Diffstat (limited to 'storage/csv')
-rw-r--r--storage/csv/ha_tina.cc15
1 files changed, 9 insertions, 6 deletions
diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc
index 92ac20a8f82..35596a59c86 100644
--- a/storage/csv/ha_tina.cc
+++ b/storage/csv/ha_tina.cc
@@ -289,7 +289,7 @@ static int read_meta_file(File meta_file, ha_rows *rows)
mysql_file_seek(meta_file, 0, MY_SEEK_SET, MYF(0));
if (mysql_file_read(meta_file, (uchar*)meta_buffer, META_BUFFER_SIZE, 0)
!= META_BUFFER_SIZE)
- DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
+ DBUG_RETURN(my_errno= HA_ERR_CRASHED_ON_USAGE);
/*
Parse out the meta data, we ignore version at the moment
@@ -418,10 +418,13 @@ static int free_share(TINA_SHARE *share)
int result_code= 0;
if (!--share->use_count){
/* Write the meta file. Mark it as crashed if needed. */
- (void)write_meta_file(share->meta_file, share->rows_recorded,
- share->crashed ? TRUE :FALSE);
- if (mysql_file_close(share->meta_file, MYF(0)))
- result_code= 1;
+ if (share->meta_file != -1)
+ {
+ (void)write_meta_file(share->meta_file, share->rows_recorded,
+ share->crashed ? TRUE :FALSE);
+ if (mysql_file_close(share->meta_file, MYF(0)))
+ result_code= 1;
+ }
if (share->tina_write_opened)
{
if (mysql_file_close(share->tina_write_filedes, MYF(0)))
@@ -930,7 +933,7 @@ int ha_tina::open(const char *name, int mode, uint open_options)
if (share->crashed && !(open_options & HA_OPEN_FOR_REPAIR))
{
free_share(share);
- DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
+ DBUG_RETURN(my_errno ? my_errno : HA_ERR_CRASHED_ON_USAGE);
}
local_data_file_version= share->data_file_version;