File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -4531,6 +4531,7 @@ static int com_source(String *, char *line)
45314531 STATUS old_status;
45324532 FILE *sql_file;
45334533 my_bool save_ignore_errors;
4534+ MY_STAT stat_info;
45344535
45354536 if (status.sandbox )
45364537 return put_info (" Not allowed in the sandbox mode" , INFO_ERROR, 0 );
@@ -4557,6 +4558,16 @@ static int com_source(String *, char *line)
45574558 return put_info (buff, INFO_ERROR, 0 );
45584559 }
45594560
4561+ /* verify it's not a directory */
4562+ if (my_fstat (fileno (sql_file), &stat_info, MYF (0 )) == 0 &&
4563+ MY_S_ISDIR (stat_info.st_mode ))
4564+ {
4565+ my_fclose (sql_file, MYF (0 ));
4566+ char buff[FN_REFLEN+60 ];
4567+ sprintf (buff, " '%s' is a directory, not a file" , source_name);
4568+ return put_info (buff, INFO_ERROR, 0 );
4569+ }
4570+
45604571 if (!(line_buff= batch_readline_init (MAX_BATCH_BUFFER_SIZE, sql_file)))
45614572 {
45624573 my_fclose (sql_file,MYF (0 ));
You can’t perform that action at this time.
0 commit comments