diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2019-02-21 14:40:52 +0100 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2019-02-21 14:40:52 +0100 |
commit | 93ac7ae70ff000353538f732899b421a3f2ea7ce (patch) | |
tree | 819b5ca057d80b42699de219c982b7924857c406 /client/mysqltest.cc | |
parent | 4932aba921755cfbc351b92c67068a5c48d3922b (diff) | |
parent | a40de1bdeb218d66d5cc737758a4bab1b06f255d (diff) | |
download | mariadb-git-93ac7ae70ff000353538f732899b421a3f2ea7ce.tar.gz |
Merge branch '10.3' into 10.4
Diffstat (limited to 'client/mysqltest.cc')
-rw-r--r-- | client/mysqltest.cc | 66 |
1 files changed, 6 insertions, 60 deletions
diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 184121e12c0..cd7e82f34e5 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -4018,63 +4018,6 @@ void do_mkdir(struct st_command *command) } -/* - Remove directory recursively. -*/ -static int rmtree(const char *dir) -{ - char path[FN_REFLEN]; - char sep[]={ FN_LIBCHAR, 0 }; - int err=0; - - MY_DIR *dir_info= my_dir(dir, MYF(MY_DONT_SORT | MY_WANT_STAT)); - if (!dir_info) - return 1; - - for (uint i= 0; i < dir_info->number_of_files; i++) - { - FILEINFO *file= dir_info->dir_entry + i; - /* Skip "." and ".." */ - if (!strcmp(file->name, ".") || !strcmp(file->name, "..")) - continue; - - strxnmov(path, sizeof(path), dir, sep, file->name, NULL); - - if (!MY_S_ISDIR(file->mystat->st_mode)) - { - err= my_delete(path, 0); -#ifdef _WIN32 - /* - On Windows, check and possible reset readonly attribute. - my_delete(), or DeleteFile does not remove theses files. - */ - if (err) - { - DWORD attr= GetFileAttributes(path); - if (attr != INVALID_FILE_ATTRIBUTES && - (attr & FILE_ATTRIBUTE_READONLY)) - { - SetFileAttributes(path, attr &~ FILE_ATTRIBUTE_READONLY); - err= my_delete(path, 0); - } - } -#endif - } - else - err= rmtree(path); - - if(err) - break; - } - - my_dirend(dir_info); - - if (!err) - err= rmdir(dir); - - return err; -} - /* SYNOPSIS @@ -4102,7 +4045,7 @@ void do_rmdir(struct st_command *command) DBUG_VOID_RETURN; DBUG_PRINT("info", ("removing directory: %s", ds_dirname.str)); - if (rmtree(ds_dirname.str)) + if (my_rmtree(ds_dirname.str, MYF(0))) handle_command_error(command, 1, errno); dynstr_free(&ds_dirname); @@ -6106,7 +6049,6 @@ void do_connect(struct st_command *command) #endif if (opt_compress || con_compress) mysql_options(con_slot->mysql, MYSQL_OPT_COMPRESS, NullS); - mysql_options(con_slot->mysql, MYSQL_OPT_LOCAL_INFILE, 0); mysql_options(con_slot->mysql, MYSQL_SET_CHARSET_NAME, csname?csname: charset_info->csname); if (opt_charsets_dir) @@ -6190,6 +6132,11 @@ void do_connect(struct st_command *command) if (con_slot == next_con) next_con++; /* if we used the next_con slot, advance the pointer */ } + else // Failed to connect. Free the memory. + { + mysql_close(con_slot->mysql); + con_slot->mysql= NULL; + } dynstr_free(&ds_connection_name); dynstr_free(&ds_host); @@ -9291,7 +9238,6 @@ int main(int argc, char **argv) (void *) &opt_connect_timeout); if (opt_compress) mysql_options(con->mysql,MYSQL_OPT_COMPRESS,NullS); - mysql_options(con->mysql, MYSQL_OPT_LOCAL_INFILE, 0); mysql_options(con->mysql, MYSQL_SET_CHARSET_NAME, charset_info->csname); if (opt_charsets_dir) |