diff options
author | Sergei Golubchik <serg@mariadb.org> | 2016-08-10 19:19:05 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2016-08-10 19:19:05 +0200 |
commit | 309c08c17c56d35e5635a5874fb70719935e5f54 (patch) | |
tree | db63b0f496364456789f390eb5f693dabf0f94a1 /sql/sys_vars.cc | |
parent | c6fdb92ca829fed893d9e7324e80b1450de16087 (diff) | |
parent | 5ad02062d928cccbd29c0a2db6f0f7ceb33195d1 (diff) | |
download | mariadb-git-309c08c17c56d35e5635a5874fb70719935e5f54.tar.gz |
Merge branch '5.5' into 10.0
Diffstat (limited to 'sql/sys_vars.cc')
-rw-r--r-- | sql/sys_vars.cc | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 060441bed72..5b2b6e32314 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -3832,14 +3832,16 @@ static bool check_log_path(sys_var *self, THD *thd, set_var *var) if (!var->save_result.string_value.str) return true; - if (var->save_result.string_value.length > FN_REFLEN) + LEX_STRING *val= &var->save_result.string_value; + + if (val->length > FN_REFLEN) { // path is too long my_error(ER_PATH_LENGTH, MYF(0), self->name.str); return true; } char path[FN_REFLEN]; - size_t path_length= unpack_filename(path, var->save_result.string_value.str); + size_t path_length= unpack_filename(path, val->str); if (!path_length) return true; @@ -3852,6 +3854,17 @@ static bool check_log_path(sys_var *self, THD *thd, set_var *var) return true; } + static const LEX_CSTRING my_cnf= { STRING_WITH_LEN("my.cnf") }; + static const LEX_CSTRING my_ini= { STRING_WITH_LEN("my.ini") }; + if (path_length >= my_cnf.length) + { + if (strcasecmp(path + path_length - my_cnf.length, my_cnf.str) == 0) + return true; // log file name ends with "my.cnf" + DBUG_ASSERT(my_cnf.length == my_ini.length); + if (strcasecmp(path + path_length - my_ini.length, my_ini.str) == 0) + return true; // log file name ends with "my.ini" + } + MY_STAT f_stat; if (my_stat(path, &f_stat, MYF(0))) @@ -3861,9 +3874,9 @@ static bool check_log_path(sys_var *self, THD *thd, set_var *var) return false; } - (void) dirname_part(path, var->save_result.string_value.str, &path_length); + (void) dirname_part(path, val->str, &path_length); - if (var->save_result.string_value.length - path_length >= FN_LEN) + if (val->length - path_length >= FN_LEN) { // filename is too long my_error(ER_PATH_LENGTH, MYF(0), self->name.str); return true; |