summaryrefslogtreecommitdiff
path: root/ext/mysql/libmysql/my_tempnam.c
diff options
context:
space:
mode:
authorZak Greant <zak@php.net>2002-06-07 15:07:55 +0000
committerZak Greant <zak@php.net>2002-06-07 15:07:55 +0000
commit9daec6d2278fb671f486100faecbbbc5a42cb863 (patch)
tree671ce507dddd5a6f28d3fc9facba1d11fa3e6426 /ext/mysql/libmysql/my_tempnam.c
parentfcd6d2b5cda9fc9ef582771b750c93ba09494828 (diff)
downloadphp-git-9daec6d2278fb671f486100faecbbbc5a42cb863.tar.gz
Updating embedded libmysql to version 3.23.48
Diffstat (limited to 'ext/mysql/libmysql/my_tempnam.c')
-rw-r--r--ext/mysql/libmysql/my_tempnam.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/ext/mysql/libmysql/my_tempnam.c b/ext/mysql/libmysql/my_tempnam.c
index f6296398ee..6dca387fa1 100644
--- a/ext/mysql/libmysql/my_tempnam.c
+++ b/ext/mysql/libmysql/my_tempnam.c
@@ -1,6 +1,13 @@
/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
This file is public domain and comes with NO WARRANTY of any kind */
+/*
+ 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"
@@ -12,7 +19,7 @@ This file is public domain and comes with NO WARRANTY of any kind */
#endif
#ifdef HAVE_TEMPNAM
-#ifndef MSDOS
+#if !defined( MSDOS) && !defined(OS2)
extern char **environ;
#endif
#endif
@@ -77,14 +84,26 @@ my_string my_tempnam(const char *dir, const char *pfx,
temp[1]= 0;
dir=temp;
}
- old_env=environ;
+#ifdef OS2
+ // 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=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 */
- environ=old_env;
+#ifndef OS2
+ environ=(const char**)old_env; /* May give warning */
+#endif
if (!res)
DBUG_PRINT("error",("Got error: %d from tempnam",errno));
return res;