qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Honor TMPDIR environment variable
@ 2008-01-28 19:27 Aurelien Jarno
  2008-02-18 11:31 ` Aurelien Jarno
  0 siblings, 1 reply; 2+ messages in thread
From: Aurelien Jarno @ 2008-01-28 19:27 UTC (permalink / raw)
  To: qemu-devel

The patch below adds support for the -snapshot option to use the TMPDIR
environment variable.

---
 block.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/block.c b/block.c
index 0f8ad7b..0730954 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);
 }

-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-02-18 11:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-28 19:27 [Qemu-devel] [PATCH] Honor TMPDIR environment variable Aurelien Jarno
2008-02-18 11:31 ` Aurelien Jarno

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).