Skip to content

Commit

Permalink
MDEV-15583 create_temp_file: remove tempnam implementation
Browse files Browse the repository at this point in the history
In the spirit of the man page "Never use this function."
lets purge off this implementation. mkstemp is a widely
available alternative.

Closes #661.
  • Loading branch information
grooverdan authored and vaintroub committed May 21, 2018
1 parent d7a047c commit 7e45b7a
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 39 deletions.
1 change: 0 additions & 1 deletion cmake/os/WindowsCache.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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 "")
Expand Down
1 change: 0 additions & 1 deletion config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
36 changes: 0 additions & 36 deletions mysys/mf_tempfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7e45b7a

Please sign in to comment.