summaryrefslogtreecommitdiff
path: root/sql/slave.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/slave.cc')
-rw-r--r--sql/slave.cc43
1 files changed, 43 insertions, 0 deletions
diff --git a/sql/slave.cc b/sql/slave.cc
index 6d48e57d298..f5e8a11efe9 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -2633,6 +2633,41 @@ err:
DBUG_RETURN(0); // Can't return anything here
}
+/*
+ Check the temporary directory used by commands like
+ LOAD DATA INFILE.
+ */
+static
+int check_temp_dir(char* tmp_dir, char *tmp_file)
+{
+ int fd;
+ MY_DIR *dirp;
+
+ DBUG_ENTER("check_temp_dir");
+
+ /*
+ Check if the directory exists.
+ */
+ if (!(dirp=my_dir(tmp_dir,MYF(MY_WME))))
+ DBUG_RETURN(1);
+ my_dirend(dirp);
+
+ /*
+ Check permissions to create a file.
+ */
+ if ((fd= my_create(tmp_file, CREATE_MODE,
+ O_WRONLY | O_BINARY | O_EXCL | O_NOFOLLOW,
+ MYF(MY_WME))) < 0)
+ DBUG_RETURN(1);
+
+ /*
+ Clean up.
+ */
+ my_close(fd, MYF(0));
+ my_delete(tmp_file, MYF(0));
+
+ DBUG_RETURN(0);
+}
/**
Slave SQL thread entry point.
@@ -2764,6 +2799,14 @@ log '%s' at position %s, relay log '%s' position: %s", RPL_LOG_NAME,
llstr(rli->group_master_log_pos,llbuff),rli->group_relay_log_name,
llstr(rli->group_relay_log_pos,llbuff1));
+ if (check_temp_dir(slave_load_tmpdir, rli->slave_patternload_file))
+ {
+ rli->report(ERROR_LEVEL, thd->main_da.sql_errno(),
+ "Unable to use slave's temporary directory %s - %s",
+ slave_load_tmpdir, thd->main_da.message());
+ goto err;
+ }
+
/* execute init_slave variable */
if (sys_init_slave.value_length)
{