diff options
author | Daniel Black <daniel@linux.vnet.ibm.com> | 2018-03-15 15:48:26 +1100 |
---|---|---|
committer | Vladislav Vaintroub <wlad@mariadb.com> | 2018-05-21 16:12:03 +0000 |
commit | 7e45b7ac1f183fa9f0db1071e07d10f905ae9f30 (patch) | |
tree | f20e29d4d3e970e069acc135e8b87c75e7d7126e | |
parent | d7a047c4c9637ef7e672a0ccd0c869d3d5f1f76e (diff) | |
download | mariadb-git-7e45b7ac1f183fa9f0db1071e07d10f905ae9f30.tar.gz |
MDEV-15583 create_temp_file: remove tempnam implementation
In the spirit of the man page "Never use this function."
lets purge off this implementation. mkstemp is a widely
available alternative.
Closes #661.
-rw-r--r-- | cmake/os/WindowsCache.cmake | 1 | ||||
-rw-r--r-- | config.h.cmake | 1 | ||||
-rw-r--r-- | configure.cmake | 1 | ||||
-rw-r--r-- | mysys/mf_tempfile.c | 36 |
4 files changed, 0 insertions, 39 deletions
diff --git a/cmake/os/WindowsCache.cmake b/cmake/os/WindowsCache.cmake index 1d8c568163a..0b0923fb8c4 100644 --- a/cmake/os/WindowsCache.cmake +++ b/cmake/os/WindowsCache.cmake @@ -239,7 +239,6 @@ SET(HAVE_SYS_VADVISE_H CACHE INTERNAL "") SET(HAVE_SYS_WAIT_H CACHE INTERNAL "") SET(HAVE_TCGETATTR CACHE INTERNAL "") SET(HAVE_TELL 1 CACHE INTERNAL "") -SET(HAVE_TEMPNAM 1 CACHE INTERNAL "") SET(HAVE_TERMCAP_H CACHE INTERNAL "") SET(HAVE_TERMIOS_H CACHE INTERNAL "") SET(HAVE_TERMIO_H CACHE INTERNAL "") diff --git a/config.h.cmake b/config.h.cmake index 3732171892b..7e480be0380 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -235,7 +235,6 @@ #cmakedefine HAVE_STRTOUL 1 #cmakedefine HAVE_STRTOULL 1 #cmakedefine HAVE_TELL 1 -#cmakedefine HAVE_TEMPNAM 1 #cmakedefine HAVE_THR_SETCONCURRENCY 1 #cmakedefine HAVE_THR_YIELD 1 #cmakedefine HAVE_TIME 1 diff --git a/configure.cmake b/configure.cmake index 17f31206975..8a83e46488e 100644 --- a/configure.cmake +++ b/configure.cmake @@ -413,7 +413,6 @@ CHECK_FUNCTION_EXISTS (strtoul HAVE_STRTOUL) CHECK_FUNCTION_EXISTS (strtoull HAVE_STRTOULL) CHECK_FUNCTION_EXISTS (strcasecmp HAVE_STRCASECMP) CHECK_FUNCTION_EXISTS (tell HAVE_TELL) -CHECK_FUNCTION_EXISTS (tempnam HAVE_TEMPNAM) CHECK_FUNCTION_EXISTS (thr_setconcurrency HAVE_THR_SETCONCURRENCY) CHECK_FUNCTION_EXISTS (thr_yield HAVE_THR_YIELD) CHECK_FUNCTION_EXISTS (vasprintf HAVE_VASPRINTF) diff --git a/mysys/mf_tempfile.c b/mysys/mf_tempfile.c index 62b3e09747f..c114180c101 100644 --- a/mysys/mf_tempfile.c +++ b/mysys/mf_tempfile.c @@ -132,42 +132,6 @@ File create_temp_file(char *to, const char *dir, const char *prefix, my_errno=tmp; } } -#elif defined(HAVE_TEMPNAM) - { - extern char **environ; - - char *res,**old_env,*temp_env[1]; - if (dir && !dir[0]) - { /* Change empty string to current dir */ - to[0]= FN_CURLIB; - to[1]= 0; - dir=to; - } - - old_env= (char**) environ; - if (dir) - { /* Don't use TMPDIR if dir is given */ - environ=(const char**) temp_env; - temp_env[0]=0; - } - - if ((res=tempnam((char*) dir, (char*) prefix))) - { - strmake(to,res,FN_REFLEN-1); - (*free)(res); - file=my_create(to,0, - (int) (O_RDWR | O_BINARY | O_TRUNC | O_EXCL | O_NOFOLLOW | - O_TEMPORARY | O_SHORT_LIVED), - MYF(MY_WME)); - - } - else - { - DBUG_PRINT("error",("Got error: %d from tempnam",errno)); - } - - environ=(const char**) old_env; - } #else #error No implementation found for create_temp_file #endif |