summaryrefslogtreecommitdiff
path: root/storage/myisam
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2020-08-24 18:52:44 +0200
committerSergei Golubchik <serg@mariadb.org>2020-08-25 20:47:52 +0200
commit62d1e3bf67a12eb6f48ac615bda119e2ed65cf16 (patch)
tree6e21609d357ea89d1c8341033d9a75564acbe87a /storage/myisam
parent29d9df16ffd725cb236238d33bd75f0722256573 (diff)
downloadmariadb-git-62d1e3bf67a12eb6f48ac615bda119e2ed65cf16.tar.gz
MDEV-23569 temporary tables can overwrite existing files
for internal temporary tables: don't use realpath(), and let them overwrite whatever orphan temp files might've left in the tmpdir (see main.error_simulation test). for user created temporary tables: we have to use realpath(), (see 3a726ab6e2e, remember DATA/INDEX DIRECTORY). don't allow them to overwrite existing files. This bug was reported by RACK911 LABS
Diffstat (limited to 'storage/myisam')
-rw-r--r--storage/myisam/mi_create.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/storage/myisam/mi_create.c b/storage/myisam/mi_create.c
index 855ac8337b9..7d6095b8a09 100644
--- a/storage/myisam/mi_create.c
+++ b/storage/myisam/mi_create.c
@@ -184,7 +184,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
if (flags & HA_CREATE_TMP_TABLE)
{
options|= HA_OPTION_TMP_TABLE;
- create_mode|= O_NOFOLLOW;
+ create_mode|= O_NOFOLLOW | (internal_table ? 0 : O_EXCL);
}
if (flags & HA_CREATE_CHECKSUM || (options & HA_OPTION_CHECKSUM))
{
@@ -618,8 +618,8 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
{
char *iext= strrchr(name, '.');
int have_iext= iext && !strcmp(iext, MI_NAME_IEXT);
- fn_format(kfilename, name, "", MI_NAME_IEXT,
- MY_UNPACK_FILENAME | MY_RETURN_REAL_PATH |
+ fn_format(kfilename, name, "", MI_NAME_IEXT, MY_UNPACK_FILENAME |
+ (internal_table ? 0 : MY_RETURN_REAL_PATH) |
(have_iext ? MY_REPLACE_EXT : MY_APPEND_EXT));
klinkname_ptr= 0;
/* Replace the current file */