Commit c06eaf21 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-4165 [PATCH] RFE: make tmpdir a build-time configurable option

support -DTMPDIR=/path in CMakeLists.txt

Patch by Honza Horak.
parent 758b012f
...@@ -245,7 +245,9 @@ SET(PLUGINDIR "${DEFAULT_MYSQL_HOME}/${INSTALL_PLUGINDIR}") ...@@ -245,7 +245,9 @@ SET(PLUGINDIR "${DEFAULT_MYSQL_HOME}/${INSTALL_PLUGINDIR}")
IF(INSTALL_SYSCONFDIR) IF(INSTALL_SYSCONFDIR)
SET(DEFAULT_SYSCONFDIR "${INSTALL_SYSCONFDIR}") SET(DEFAULT_SYSCONFDIR "${INSTALL_SYSCONFDIR}")
ENDIF() ENDIF()
IF(TMPDIR)
SET(DEFAULT_TMPDIR "${TMPDIR}")
ENDIF()
# Run platform tests # Run platform tests
INCLUDE(configure.cmake) INCLUDE(configure.cmake)
......
...@@ -619,6 +619,7 @@ ...@@ -619,6 +619,7 @@
#cmakedefine DEFAULT_CHARSET_HOME "@DEFAULT_CHARSET_HOME@" #cmakedefine DEFAULT_CHARSET_HOME "@DEFAULT_CHARSET_HOME@"
#cmakedefine PLUGINDIR "@PLUGINDIR@" #cmakedefine PLUGINDIR "@PLUGINDIR@"
#cmakedefine DEFAULT_SYSCONFDIR "@DEFAULT_SYSCONFDIR@" #cmakedefine DEFAULT_SYSCONFDIR "@DEFAULT_SYSCONFDIR@"
#cmakedefine DEFAULT_TMPDIR "@DEFAULT_TMPDIR@"
#cmakedefine SO_EXT "@CMAKE_SHARED_MODULE_SUFFIX@" #cmakedefine SO_EXT "@CMAKE_SHARED_MODULE_SUFFIX@"
......
...@@ -1515,4 +1515,11 @@ static inline double rint(double x) ...@@ -1515,4 +1515,11 @@ static inline double rint(double x)
#endif /* EMBEDDED_LIBRARY */ #endif /* EMBEDDED_LIBRARY */
/*
Define default tmpdir if not already set.
*/
#if !defined(DEFAULT_TMPDIR)
#define DEFAULT_TMPDIR P_tmpdir
#endif
#endif /* my_global_h */ #endif /* my_global_h */
...@@ -559,7 +559,7 @@ int init_embedded_server(int argc, char **argv, char **groups) ...@@ -559,7 +559,7 @@ int init_embedded_server(int argc, char **argv, char **groups)
opt_mysql_tmpdir=getenv("TMP"); opt_mysql_tmpdir=getenv("TMP");
#endif #endif
if (!opt_mysql_tmpdir || !opt_mysql_tmpdir[0]) if (!opt_mysql_tmpdir || !opt_mysql_tmpdir[0])
opt_mysql_tmpdir=(char*) P_tmpdir; /* purecov: inspected */ opt_mysql_tmpdir=(char*) DEFAULT_TMPDIR; /* purecov: inspected */
init_ssl(); init_ssl();
umask(((~my_umask) & 0666)); umask(((~my_umask) & 0666));
......
...@@ -43,7 +43,7 @@ my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist) ...@@ -43,7 +43,7 @@ my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist)
pathlist=getenv("TMP"); pathlist=getenv("TMP");
#endif #endif
if (!pathlist || !pathlist[0]) if (!pathlist || !pathlist[0])
pathlist=(char*) P_tmpdir; pathlist=(char*) DEFAULT_TMPDIR;
} }
do do
{ {
......
...@@ -111,7 +111,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix, ...@@ -111,7 +111,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix,
sizeof(prefix_buff)-7),"XXXXXX") - sizeof(prefix_buff)-7),"XXXXXX") -
prefix_buff); prefix_buff);
if (!dir && ! (dir =getenv("TMPDIR"))) if (!dir && ! (dir =getenv("TMPDIR")))
dir=P_tmpdir; dir=DEFAULT_TMPDIR;
if (strlen(dir)+ pfx_len > FN_REFLEN-2) if (strlen(dir)+ pfx_len > FN_REFLEN-2)
{ {
errno=my_errno= ENAMETOOLONG; errno=my_errno= ENAMETOOLONG;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment