diff options
author | aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-03-10 00:05:34 +0000 |
---|---|---|
committer | aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-03-10 00:05:34 +0000 |
commit | 0badc1ee0e6ab8622b2f9b4ebc3c5ab96f0b58d0 (patch) | |
tree | c265c26dbc6b2d961b18d1435e188a5b152bc39e /block.c | |
parent | e94bbefe59c0463f5187c6adf9d6d08562112dad (diff) |
Honor TMPDIR environment variable
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4033 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'block.c')
-rw-r--r-- | block.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -191,8 +191,12 @@ void get_tmp_filename(char *filename, int size) void get_tmp_filename(char *filename, int size) { int fd; + char *tmpdir; /* XXX: race condition possible */ - pstrcpy(filename, size, "/tmp/vl.XXXXXX"); + tmpdir = getenv("TMPDIR"); + if (!tmpdir) + tmpdir = "/tmp"; + snprintf(filename, size, "%s/vl.XXXXXX", tmpdir); fd = mkstemp(filename); close(fd); } |