mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
merging
This commit is contained in:
@@ -74,7 +74,7 @@ MI_INFO *test_if_reopen(char *filename)
|
||||
|
||||
MI_INFO *mi_open(const char *name, int mode, uint open_flags)
|
||||
{
|
||||
int lock_error,kfile,open_mode,save_errno,have_rtree=0;
|
||||
int lock_error,kfile,open_mode,save_errno,have_rtree=0, realpath_err;
|
||||
uint i,j,len,errpos,head_length,base_pos,offset,info_length,keys,
|
||||
key_parts,unique_key_parts,fulltext_keys,uniques;
|
||||
char name_buff[FN_REFLEN], org_name[FN_REFLEN], index_name[FN_REFLEN],
|
||||
@@ -94,8 +94,15 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
|
||||
head_length=sizeof(share_buff.state.header);
|
||||
bzero((uchar*) &info,sizeof(info));
|
||||
|
||||
my_realpath(name_buff, fn_format(org_name,name,"",MI_NAME_IEXT,
|
||||
MY_UNPACK_FILENAME),MYF(0));
|
||||
realpath_err= my_realpath(name_buff,
|
||||
fn_format(org_name,name,"",MI_NAME_IEXT,4),MYF(0));
|
||||
if (my_is_symlink(org_name) &&
|
||||
(realpath_err || (*myisam_test_invalid_symlink)(name_buff)))
|
||||
{
|
||||
my_errno= HA_WRONG_CREATE_OPTION;
|
||||
DBUG_RETURN (NULL);
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&THR_LOCK_myisam);
|
||||
if (!(old_info=test_if_reopen(name_buff)))
|
||||
{
|
||||
@@ -476,7 +483,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
|
||||
lock_error=1; /* Database unlocked */
|
||||
}
|
||||
|
||||
if (mi_open_datafile(&info, share, -1))
|
||||
if (mi_open_datafile(&info, share, name, -1))
|
||||
goto err;
|
||||
errpos=5;
|
||||
|
||||
@@ -556,7 +563,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
|
||||
my_errno=EACCES; /* Can't open in write mode */
|
||||
goto err;
|
||||
}
|
||||
if (mi_open_datafile(&info, share, old_info->dfile))
|
||||
if (mi_open_datafile(&info, share, name, old_info->dfile))
|
||||
goto err;
|
||||
errpos=5;
|
||||
have_rtree= old_info->rtree_recursion_state != NULL;
|
||||
@@ -1217,13 +1224,30 @@ The argument file_to_dup is here for the future if there would on some OS
|
||||
exist a dup()-like call that would give us two different file descriptors.
|
||||
*************************************************************************/
|
||||
|
||||
int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share,
|
||||
int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share, const char *org_name,
|
||||
File file_to_dup __attribute__((unused)))
|
||||
{
|
||||
char *data_name= share->data_file_name;
|
||||
char real_data_name[FN_REFLEN];
|
||||
|
||||
if (org_name)
|
||||
{
|
||||
fn_format(real_data_name,org_name,"",MI_NAME_DEXT,4);
|
||||
if (my_is_symlink(real_data_name))
|
||||
{
|
||||
if (my_realpath(real_data_name, real_data_name, MYF(0)) ||
|
||||
(*myisam_test_invalid_symlink)(real_data_name))
|
||||
{
|
||||
my_errno= HA_WRONG_CREATE_OPTION;
|
||||
return 1;
|
||||
}
|
||||
data_name= real_data_name;
|
||||
}
|
||||
}
|
||||
#ifdef USE_RAID
|
||||
if (share->base.raid_type)
|
||||
{
|
||||
info->dfile=my_raid_open(share->data_file_name,
|
||||
info->dfile=my_raid_open(data_name,
|
||||
share->mode | O_SHARE,
|
||||
share->base.raid_type,
|
||||
share->base.raid_chunks,
|
||||
@@ -1232,8 +1256,7 @@ int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share,
|
||||
}
|
||||
else
|
||||
#endif
|
||||
info->dfile=my_open(share->data_file_name, share->mode | O_SHARE,
|
||||
MYF(MY_WME));
|
||||
info->dfile=my_open(data_name, share->mode | O_SHARE, MYF(MY_WME));
|
||||
return info->dfile >= 0 ? 0 : 1;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user