Honor TMPDIR environment variable
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4033 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
e94bbefe59
commit
0badc1ee0e
6
block.c
6
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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user