winegcc: Respect TMPDIR environment variable.

This commit is contained in:
André Hentschel 2014-09-23 22:22:28 +02:00 committed by Alexandre Julliard
parent dcdf4dbf15
commit 20006966ab
1 changed files with 5 additions and 2 deletions

View File

@ -268,9 +268,12 @@ static char* get_temp_file(const char* prefix, const char* suffix)
fd = mkstemps( tmp, strlen(suffix) );
if (fd == -1)
{
/* could not create it in current directory, try in /tmp */
/* could not create it in current directory, try in TMPDIR */
const char* tmpdir;
free(tmp);
tmp = strmake("/tmp/%s-XXXXXX%s", prefix, suffix);
if (!(tmpdir = getenv("TMPDIR"))) tmpdir = "/tmp";
tmp = strmake("%s/%s-XXXXXX%s", tmpdir, prefix, suffix);
fd = mkstemps( tmp, strlen(suffix) );
if (fd == -1) error( "could not create temp file\n" );
}