summaryrefslogtreecommitdiff
path: root/storage/myisam/mi_create.c
diff options
context:
space:
mode:
authorunknown <istruewing@chilla.local>2007-03-07 16:30:13 +0100
committerunknown <istruewing@chilla.local>2007-03-07 16:30:13 +0100
commit54356b6fcf487e857d229e8dfd99d9f8da50494c (patch)
tree20c146441fb116800f2e47317e81b9818bfbaf95 /storage/myisam/mi_create.c
parent8bf49833318770d5e9a559b8cdc66f9cc02a5f55 (diff)
downloadmariadb-git-54356b6fcf487e857d229e8dfd99d9f8da50494c.tar.gz
Bug#26782 - Patch: myisamchk -rq creates .MYI.MYI file
on packed MyISAM tables When fixing the indexes with "myisamchk -rq" after compressing the table with "myisampack", an optionally supplied extension ".MYI" of the index file was not detected. The extension was appended unconditionally. The result was ".MYI.MYI". Now an extension is no longer appended if present already. Thanks to David Shrewsbury for providing this patch. Another problem was a misplaced parenthesis. We did never unpack the file name ("~/..") and always returned a real path. No test case. This is manually tested with the utilities "myisampack" and "myisamchk". storage/myisam/mi_create.c: Bug#26782 - Patch: myisamchk -rq creates .MYI.MYI file on packed MyISAM tables Added code to detect existing extension on index file name. Thanks to David Shrewsbury for providing this patch. Additionally fixed an parenthesis. We did never unpack the file name and always returned real path.
Diffstat (limited to 'storage/myisam/mi_create.c')
-rw-r--r--storage/myisam/mi_create.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/storage/myisam/mi_create.c b/storage/myisam/mi_create.c
index 2b8cbcc7da5..e2245aff065 100644
--- a/storage/myisam/mi_create.c
+++ b/storage/myisam/mi_create.c
@@ -599,10 +599,12 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
}
else
{
+ char *iext= strrchr(name, '.');
+ int have_iext= iext && !strcmp(iext, MI_NAME_IEXT);
fn_format(filename, name, "", MI_NAME_IEXT,
- (MY_UNPACK_FILENAME |
- (flags & HA_DONT_TOUCH_DATA) ? MY_RETURN_REAL_PATH : 0) |
- MY_APPEND_EXT);
+ MY_UNPACK_FILENAME |
+ ((flags & HA_DONT_TOUCH_DATA) ? MY_RETURN_REAL_PATH : 0) |
+ (have_iext ? MY_REPLACE_EXT : MY_APPEND_EXT));
linkname_ptr=0;
/* Replace the current file */
create_flag=MY_DELETE_OLD;