summaryrefslogtreecommitdiff
path: root/mysys/my_tempnam.c
diff options
context:
space:
mode:
Diffstat (limited to 'mysys/my_tempnam.c')
-rw-r--r--mysys/my_tempnam.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/mysys/my_tempnam.c b/mysys/my_tempnam.c
index 7da037e8d49..fdaf018af0d 100644
--- a/mysys/my_tempnam.c
+++ b/mysys/my_tempnam.c
@@ -15,6 +15,13 @@
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA */
+/*
+ This function is only used by some old ISAM code.
+ When we remove ISAM support from MySQL, we should also delete this file
+
+ One should instead use the functions in mf_tempfile.c
+*/
+
#include "mysys_priv.h"
#include <m_string.h>
#include "my_static.h"
@@ -95,18 +102,21 @@ my_string my_tempnam(const char *dir, const char *pfx,
// changing environ variable doesn't work with VACPP
char buffer[256];
sprintf( buffer, "TMP=%s", dir);
+ // remove ending backslash
+ if (buffer[strlen(buffer)-1] == '\\')
+ buffer[strlen(buffer)-1] = '\0';
putenv( buffer);
#else
old_env=(char**)environ;
if (dir)
{ /* Don't use TMPDIR if dir is given */
- environ=(const char**)temp_env;
+ environ=(const char**)temp_env; /* May give warning */
temp_env[0]=0;
}
#endif
res=tempnam((char*) dir,(my_string) pfx); /* Use stand. dir with prefix */
#ifndef OS2
- environ=(const char**)old_env;
+ environ=(const char**)old_env; /* May give warning */
#endif
if (!res)
DBUG_PRINT("error",("Got error: %d from tempnam",errno));