提交 0badc1ee 编写于 作者: A aurel32

Honor TMPDIR environment variable


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4033 c046a42c-6fe2-441c-8c8c-71466251a162
上级 e94bbefe
......@@ -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);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册