diff options
-rw-r--r-- | CMakeLists.txt | 9 | ||||
-rw-r--r-- | config.h.cmake | 3 | ||||
-rw-r--r-- | libmysqld/lib_sql.cc | 2 | ||||
-rw-r--r-- | mysys/mf_tempdir.c | 4 | ||||
-rw-r--r-- | mysys/mf_tempfile.c | 4 |
5 files changed, 16 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a9c0da97525..d47e04c61b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -329,6 +329,15 @@ IF(SYSCONFDIR) SET(DEFAULT_SYSCONFDIR "${SYSCONFDIR}") ENDIF() +OPTION(TMPDIR +"PATH to MySQL TMP dir. If unspecified, defaults to P_tmpdir in <stdio.h>" OFF) +IF(TMPDIR) + # Quote it, to make it a const char string. + SET(DEFAULT_TMPDIR "\"${TMPDIR}\"") +ELSE() + # Do not quote it, to refer to the P_tmpdir macro in <stdio.h>. + SET(DEFAULT_TMPDIR "P_tmpdir") +ENDIF() # Run platform tests INCLUDE(configure.cmake) diff --git a/config.h.cmake b/config.h.cmake index 8c146011c7b..8c93da072fb 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -1,4 +1,4 @@ -/* Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -600,6 +600,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/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index 70cbe6080d7..0e77ddc923c 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -558,7 +558,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= const_cast<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..34b469b4066 100644 --- a/mysys/mf_tempdir.c +++ b/mysys/mf_tempdir.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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= DEFAULT_TMPDIR; } do { diff --git a/mysys/mf_tempfile.c b/mysys/mf_tempfile.c index 15482075c39..62b3e09747f 100644 --- a/mysys/mf_tempfile.c +++ b/mysys/mf_tempfile.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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; |