diff options
author | Vladislav Vaintroub <wlad@montyprogram.com> | 2011-05-12 15:31:11 +0200 |
---|---|---|
committer | Vladislav Vaintroub <wlad@montyprogram.com> | 2011-05-12 15:31:11 +0200 |
commit | 1c95254523954637ae1904c436916ed1da13f378 (patch) | |
tree | a1c27aa09c545a85c6cb703a4c72c1f6b8a81652 /sql/sql_table.cc | |
parent | 520927a7df486a1a21f87dadd9c5a920bf583917 (diff) | |
download | mariadb-git-1c95254523954637ae1904c436916ed1da13f378.tar.gz |
Fix check_table_file_presence:
On Windows, do not attempt access() for special device names like
CON, PRN etc. access() would return 0, this does not mean that fiile
with this name exists.
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r-- | sql/sql_table.cc | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index d76f1a427be..feacecd40a5 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -3645,9 +3645,19 @@ bool check_table_file_presence(char *old_path, Except case when it is the same table. */ char tbl50[FN_REFLEN]; +#ifdef _WIN32 + if (check_if_legal_tablename(table_name) != 0) + { + /* + Check for reserved device names for which access() returns 0 + (CON, AUX etc). + */ + return FALSE; + } +#endif strxmov(tbl50, mysql_data_home, "/", db, "/", table_name, NullS); - if (!access(fn_format(tbl50, tbl50, "", reg_ext, - MY_UNPACK_FILENAME), F_OK) && + fn_format(tbl50, tbl50, "", reg_ext, MY_UNPACK_FILENAME); + if (!access(tbl50, F_OK) && (old_path == NULL || strcmp(old_path, tbl50) != 0)) { |