aboutsummaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authoraurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>2008-03-10 00:05:34 +0000
committeraurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>2008-03-10 00:05:34 +0000
commit0badc1ee0e6ab8622b2f9b4ebc3c5ab96f0b58d0 (patch)
treec265c26dbc6b2d961b18d1435e188a5b152bc39e /block.c
parente94bbefe59c0463f5187c6adf9d6d08562112dad (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.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/block.c b/block.c
index 0f8ad7bce2..07309541f3 100644
--- a/block.c
+++ b/block.c
@@ -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);
}