Skip to content

Commit bcb7d9c

Browse files
lthfacebook-github-bot
authored andcommitted
Add MY_APPEND_EXT flag when determining file names for mysqldump
Summary: Currently, if a table name contains a dot, the fn_format function assumes that this is a file with an extension already. Instead we should always be appending the ".sql" and ".txt" extensions for table names. Filed a bug upstream: https://bugs.mysql.com/bug.php?id=90314 Reviewed By: hermanlee Differential Revision: D7518632 fbshipit-source-id: 4937d1b
1 parent 6f8a6f1 commit bcb7d9c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

client/mysqldump.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1646,7 +1646,8 @@ static FILE* open_sql_file_for_table(const char* table, int flags)
16461646
FILE* res;
16471647
char filename[FN_REFLEN], tmp_path[FN_REFLEN];
16481648
convert_dirname(tmp_path,path,NullS);
1649-
res= my_fopen(fn_format(filename, table, tmp_path, ".sql", 4),
1649+
res= my_fopen(fn_format(filename, table, tmp_path, ".sql",
1650+
MYF(MY_UNPACK_FILENAME | MY_APPEND_EXT)),
16501651
flags, MYF(MY_WME));
16511652
return res;
16521653
}
@@ -4089,7 +4090,7 @@ static void dump_table(char *table, char *db)
40894090
*/
40904091
convert_dirname(tmp_path,path,NullS);
40914092
my_load_path(tmp_path, tmp_path, NULL);
4092-
fn_format(filename, table, tmp_path, ".txt", MYF(MY_UNPACK_FILENAME));
4093+
fn_format(filename, table, tmp_path, ".txt", MYF(MY_UNPACK_FILENAME | MY_APPEND_EXT));
40934094

40944095
/* Must delete the file that 'INTO OUTFILE' will write to */
40954096
my_delete(filename, MYF(0));

0 commit comments

Comments
 (0)