summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-08-17 17:20:09 +0400
committerSergei Golubchik <sergii@pisem.net>2013-08-17 17:20:09 +0400
commitc06eaf21b78093524e1a39c55415d4eab3d2cd78 (patch)
tree0b0e1ed3d8c1e877f2e66651cf999b5af5e64975
parent758b012ff23597faa099a2f9562a54f1bae2cca6 (diff)
downloadmariadb-git-c06eaf21b78093524e1a39c55415d4eab3d2cd78.tar.gz
MDEV-4165 [PATCH] RFE: make tmpdir a build-time configurable option
support -DTMPDIR=/path in CMakeLists.txt Patch by Honza Horak.
-rw-r--r--CMakeLists.txt4
-rw-r--r--config.h.cmake1
-rw-r--r--include/my_global.h7
-rw-r--r--libmysqld/lib_sql.cc2
-rw-r--r--mysys/mf_tempdir.c2
-rw-r--r--mysys/mf_tempfile.c2
6 files changed, 14 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7e22918dd64..40062957372 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -245,7 +245,9 @@ SET(PLUGINDIR "${DEFAULT_MYSQL_HOME}/${INSTALL_PLUGINDIR}")
IF(INSTALL_SYSCONFDIR)
SET(DEFAULT_SYSCONFDIR "${INSTALL_SYSCONFDIR}")
ENDIF()
-
+IF(TMPDIR)
+ SET(DEFAULT_TMPDIR "${TMPDIR}")
+ENDIF()
# Run platform tests
INCLUDE(configure.cmake)
diff --git a/config.h.cmake b/config.h.cmake
index 8c28b997f87..277d232c464 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -619,6 +619,7 @@
#cmakedefine DEFAULT_CHARSET_HOME "@DEFAULT_CHARSET_HOME@"
#cmakedefine PLUGINDIR "@PLUGINDIR@"
#cmakedefine DEFAULT_SYSCONFDIR "@DEFAULT_SYSCONFDIR@"
+#cmakedefine DEFAULT_TMPDIR "@DEFAULT_TMPDIR@"
#cmakedefine SO_EXT "@CMAKE_SHARED_MODULE_SUFFIX@"
diff --git a/include/my_global.h b/include/my_global.h
index 2f42349b265..2f097847c89 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -1515,4 +1515,11 @@ static inline double rint(double x)
#endif /* EMBEDDED_LIBRARY */
+/*
+ Define default tmpdir if not already set.
+*/
+#if !defined(DEFAULT_TMPDIR)
+#define DEFAULT_TMPDIR P_tmpdir
+#endif
+
#endif /* my_global_h */
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index e73fe4b8b77..88f8f039ce2 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -559,7 +559,7 @@ int init_embedded_server(int argc, char **argv, char **groups)
opt_mysql_tmpdir=getenv("TMP");
#endif
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();
umask(((~my_umask) & 0666));
diff --git a/mysys/mf_tempdir.c b/mysys/mf_tempdir.c
index eceb90bb619..e6b56f7d1d0 100644
--- a/mysys/mf_tempdir.c
+++ b/mysys/mf_tempdir.c
@@ -43,7 +43,7 @@ my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist)
pathlist=getenv("TMP");
#endif
if (!pathlist || !pathlist[0])
- pathlist=(char*) P_tmpdir;
+ pathlist=(char*) DEFAULT_TMPDIR;
}
do
{
diff --git a/mysys/mf_tempfile.c b/mysys/mf_tempfile.c
index 15482075c39..5ff139bc92a 100644
--- a/mysys/mf_tempfile.c
+++ b/mysys/mf_tempfile.c
@@ -111,7 +111,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix,
sizeof(prefix_buff)-7),"XXXXXX") -
prefix_buff);
if (!dir && ! (dir =getenv("TMPDIR")))
- dir=P_tmpdir;
+ dir=DEFAULT_TMPDIR;
if (strlen(dir)+ pfx_len > FN_REFLEN-2)
{
errno=my_errno= ENAMETOOLONG;