mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
don't rely on readdir() returning . and .. first
This commit is contained in:
@ -2255,9 +2255,15 @@ static void mysql_rm_tmp_tables(void)
|
|||||||
** Remove all SQLxxx tables from directory
|
** Remove all SQLxxx tables from directory
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for (idx=2 ; idx < (uint) dirp->number_off_files ; idx++)
|
for (idx=0 ; idx < (uint) dirp->number_off_files ; idx++)
|
||||||
{
|
{
|
||||||
file=dirp->dir_entry+idx;
|
file=dirp->dir_entry+idx;
|
||||||
|
|
||||||
|
/* skiping . and .. */
|
||||||
|
if (file->name[0] == '.' && (!file->name[1] ||
|
||||||
|
(file->name[1] == '.' && !file->name[2])))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (!bcmp(file->name,tmp_file_prefix,tmp_file_prefix_length))
|
if (!bcmp(file->name,tmp_file_prefix,tmp_file_prefix_length))
|
||||||
{
|
{
|
||||||
sprintf(filePath,"%s%s",mysql_tmpdir,file->name); /* purecov: inspected */
|
sprintf(filePath,"%s%s",mysql_tmpdir,file->name); /* purecov: inspected */
|
||||||
|
@ -237,7 +237,7 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
|
|||||||
|
|
||||||
tot_list_next= &tot_list;
|
tot_list_next= &tot_list;
|
||||||
|
|
||||||
for (uint idx=2 ;
|
for (uint idx=0 ;
|
||||||
idx < (uint) dirp->number_off_files && !thd->killed ;
|
idx < (uint) dirp->number_off_files && !thd->killed ;
|
||||||
idx++)
|
idx++)
|
||||||
{
|
{
|
||||||
@ -245,6 +245,11 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
|
|||||||
char *extension;
|
char *extension;
|
||||||
DBUG_PRINT("info",("Examining: %s", file->name));
|
DBUG_PRINT("info",("Examining: %s", file->name));
|
||||||
|
|
||||||
|
/* skiping . and .. */
|
||||||
|
if (file->name[0] == '.' && (!file->name[1] ||
|
||||||
|
(file->name[1] == '.' && !file->name[2])))
|
||||||
|
continue;
|
||||||
|
|
||||||
/* Check if file is a raid directory */
|
/* Check if file is a raid directory */
|
||||||
if ((isdigit(file->name[0]) ||
|
if ((isdigit(file->name[0]) ||
|
||||||
(file->name[0] >= 'a' && file->name[0] <= 'f')) &&
|
(file->name[0] >= 'a' && file->name[0] <= 'f')) &&
|
||||||
|
Reference in New Issue
Block a user