From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HSNwi-0005cD-PR for qemu-devel@nongnu.org; Fri, 16 Mar 2007 21:43:00 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HSNwh-0005bs-Ow for qemu-devel@nongnu.org; Fri, 16 Mar 2007 21:43:00 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HSNwh-0005bp-IL for qemu-devel@nongnu.org; Fri, 16 Mar 2007 20:42:59 -0500 Received: from hermes.devsoft.com ([88.217.203.2]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1HSNvW-0005Jp-7E for qemu-devel@nongnu.org; Fri, 16 Mar 2007 21:41:46 -0400 Date: Sat, 17 Mar 2007 02:40:59 +0100 From: Oliver Adler Message-ID: <20070317014058.GD25003@hermes.devsoft.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] Use TMPDIR environment Variable for Snapshot Mode Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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+ Sat Mar 17 02:06:26 2007 +++ block.c Fri Mar 16 23:21:21 2007 @@ -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