Module: wine Branch: master Commit: 20006966ab737e3da0ed107cf0dfb1e349be205d URL: http://source.winehq.org/git/wine.git/?a=commit;h=20006966ab737e3da0ed107cf0...
Author: André Hentschel nerv@dawncrow.de Date: Tue Sep 23 22:22:28 2014 +0200
winegcc: Respect TMPDIR environment variable.
---
tools/winegcc/winegcc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c index 72e2e69..a2f09d2 100644 --- a/tools/winegcc/winegcc.c +++ b/tools/winegcc/winegcc.c @@ -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" ); }