Skip to contentSkip to conversation

Use TMPDIR environment Variable for Snapshot Mode

Qemu-devel Oliver Adler 1 participant 1 message Mar 17, 2007

lore
Share & tools
lore
#0 lore raw

Hi Folks,
thank you VERY MUCH for bringing qemu to us.

I would like to see this little modification, honoring the setting of the TMPDIR environment variable. Then I can use the snapshot mode even if my /tmp directory is small in size:

The diff is based on the qemu-0.9.0 release.

block.c renamed from block.c+ +6 -1
@@ -188,8 +188,13 @@
 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 == NULL)
+	tmpdir = "/tmp";
+    snprintf(filename, size, "%s/vl.XXXXXX", tmpdir);
+//    pstrcpy(filename, size, "/tmp/vl.XXXXXX");
     fd = mkstemp(filename);
     close(fd);
 }

Thank you

Oliver