diff options
author | monty@donna.mysql.com <> | 2001-01-21 16:30:16 +0200 |
---|---|---|
committer | monty@donna.mysql.com <> | 2001-01-21 16:30:16 +0200 |
commit | 62771338ca94eee0dfd23a2d5c2fab0269ff1508 (patch) | |
tree | c772f489364087df96cf8f0582915a11ba82ae54 /merge | |
parent | efb0dad5a8889ea8f08fb4d9493e221b18a610e1 (diff) | |
download | mariadb-git-62771338ca94eee0dfd23a2d5c2fab0269ff1508.tar.gz |
Changes for --with-server-suffix
Fixed mutex bug in logging (crash on windows when doing SET PASSWORD=)
Changed MERGE tables to not use FILE
Diffstat (limited to 'merge')
-rw-r--r-- | merge/open.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/merge/open.c b/merge/open.c index 18d3b53fa84..2a3d815cd27 100644 --- a/merge/open.c +++ b/merge/open.c @@ -36,11 +36,12 @@ int mode; int handle_locking; { int save_errno,i,errpos; - uint files,dir_length; + uint files,dir_length,length; ulonglong file_offset; char name_buff[FN_REFLEN*2],buff[FN_REFLEN],*end; MRG_INFO info,*m_info; - FILE *file; + File fd; + IO_CACHE file; N_INFO *isam,*last_isam; DBUG_ENTER("mrg_open"); @@ -48,15 +49,18 @@ int handle_locking; isam=0; errpos=files=0; bzero((gptr) &info,sizeof(info)); - if (!(file=my_fopen(fn_format(name_buff,name,"",MRG_NAME_EXT,4), - O_RDONLY | O_SHARE,MYF(0)))) + bzero((char*) &file,sizeof(file)); + if ((fd=my_open(fn_format(name_buff,name,"",MRG_NAME_EXT,4), + O_RDONLY | O_SHARE,MYF(0))) < 0 || + init_io_cache(&file, fd, IO_SIZE, READ_CACHE, 0, 0, + MYF(MY_WME | MY_NABP))) goto err; errpos=1; dir_length=dirname_part(name_buff,name); info.reclength=0; - while (fgets(buff,FN_REFLEN-1,file)) + while ((length=my_b_gets(&file,buff,FN_REFLEN-1))) { - if ((end=strend(buff))[-1] == '\n') + if ((end=buff+length)[-1] == '\n') end[-1]='\0'; if (buff[0]) /* Skipp empty lines */ { @@ -113,7 +117,8 @@ int handle_locking; m_info->end_table=m_info->open_tables+files; m_info->last_used_table=m_info->open_tables; - VOID(my_fclose(file,MYF(0))); + VOID(my_close(fd,MYF(0))); + end_io_cache(&file); m_info->open_list.data=(void*) m_info; pthread_mutex_lock(&THR_LOCK_open); mrg_open_list=list_add(mrg_open_list,&m_info->open_list); @@ -124,7 +129,8 @@ err: save_errno=my_errno; switch (errpos) { case 1: - VOID(my_fclose(file,MYF(0))); + VOID(my_close(fd,MYF(0))); + end_io_cache(&file); for (i=files ; i-- > 0 ; ) { isam=last_isam; |