Check TMP and TEMP environment variables in addition to TMPDIR.

Windows uses TMP and TEMP, but we still check for TMPDIR, which some
scripts may set.
This commit is contained in:
Johannes Sixt
2007-05-24 22:28:41 +02:00
parent afd5e6acb2
commit 4694606a42

5
path.c
View File

@@ -73,7 +73,10 @@ int git_mkstemp(char *path, size_t len, const char *template)
{
char *env, *pch = path;
if ((env = getenv("TMPDIR")) == NULL) {
if ((env = getenv("TMPDIR")) == NULL &&
/* on Windows it is TMP and TEMP */
(env = getenv("TMP")) == NULL &&
(env = getenv("TEMP")) == NULL) {
strcpy(pch, "/tmp/");
len -= 5;
pch += 5;