Commit 3537267d authored by Daniel Black's avatar Daniel Black Committed by Sergei Golubchik

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.
parent f428a123
...@@ -239,7 +239,6 @@ SET(HAVE_SYS_VADVISE_H CACHE INTERNAL "") ...@@ -239,7 +239,6 @@ SET(HAVE_SYS_VADVISE_H CACHE INTERNAL "")
SET(HAVE_SYS_WAIT_H CACHE INTERNAL "") SET(HAVE_SYS_WAIT_H CACHE INTERNAL "")
SET(HAVE_TCGETATTR CACHE INTERNAL "") SET(HAVE_TCGETATTR CACHE INTERNAL "")
SET(HAVE_TELL 1 CACHE INTERNAL "") SET(HAVE_TELL 1 CACHE INTERNAL "")
SET(HAVE_TEMPNAM 1 CACHE INTERNAL "")
SET(HAVE_TERMCAP_H CACHE INTERNAL "") SET(HAVE_TERMCAP_H CACHE INTERNAL "")
SET(HAVE_TERMIOS_H CACHE INTERNAL "") SET(HAVE_TERMIOS_H CACHE INTERNAL "")
SET(HAVE_TERMIO_H CACHE INTERNAL "") SET(HAVE_TERMIO_H CACHE INTERNAL "")
......
...@@ -235,7 +235,6 @@ ...@@ -235,7 +235,6 @@
#cmakedefine HAVE_STRTOUL 1 #cmakedefine HAVE_STRTOUL 1
#cmakedefine HAVE_STRTOULL 1 #cmakedefine HAVE_STRTOULL 1
#cmakedefine HAVE_TELL 1 #cmakedefine HAVE_TELL 1
#cmakedefine HAVE_TEMPNAM 1
#cmakedefine HAVE_THR_SETCONCURRENCY 1 #cmakedefine HAVE_THR_SETCONCURRENCY 1
#cmakedefine HAVE_THR_YIELD 1 #cmakedefine HAVE_THR_YIELD 1
#cmakedefine HAVE_TIME 1 #cmakedefine HAVE_TIME 1
......
...@@ -413,7 +413,6 @@ CHECK_FUNCTION_EXISTS (strtoul HAVE_STRTOUL) ...@@ -413,7 +413,6 @@ CHECK_FUNCTION_EXISTS (strtoul HAVE_STRTOUL)
CHECK_FUNCTION_EXISTS (strtoull HAVE_STRTOULL) CHECK_FUNCTION_EXISTS (strtoull HAVE_STRTOULL)
CHECK_FUNCTION_EXISTS (strcasecmp HAVE_STRCASECMP) CHECK_FUNCTION_EXISTS (strcasecmp HAVE_STRCASECMP)
CHECK_FUNCTION_EXISTS (tell HAVE_TELL) CHECK_FUNCTION_EXISTS (tell HAVE_TELL)
CHECK_FUNCTION_EXISTS (tempnam HAVE_TEMPNAM)
CHECK_FUNCTION_EXISTS (thr_setconcurrency HAVE_THR_SETCONCURRENCY) CHECK_FUNCTION_EXISTS (thr_setconcurrency HAVE_THR_SETCONCURRENCY)
CHECK_FUNCTION_EXISTS (thr_yield HAVE_THR_YIELD) CHECK_FUNCTION_EXISTS (thr_yield HAVE_THR_YIELD)
CHECK_FUNCTION_EXISTS (vasprintf HAVE_VASPRINTF) CHECK_FUNCTION_EXISTS (vasprintf HAVE_VASPRINTF)
......
...@@ -132,42 +132,6 @@ File create_temp_file(char *to, const char *dir, const char *prefix, ...@@ -132,42 +132,6 @@ File create_temp_file(char *to, const char *dir, const char *prefix,
my_errno=tmp; 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 #else
#error No implementation found for create_temp_file #error No implementation found for create_temp_file
#endif #endif
......
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