summaryrefslogtreecommitdiffstats
path: root/src/launch.c
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2011-01-19 21:47:23 +0000
committerRichard W.M. Jones <rjones@redhat.com>2011-01-19 21:47:23 +0000
commit78f1405de05ef1f2efebafd8245658d1707e59ef (patch)
tree062f322970f73e19bfdfc65b84d7887a781e92f2 /src/launch.c
parent316ad8311a41869cf5f253225137dd03d1211ce7 (diff)
downloadlibguestfs-78f1405de05ef1f2efebafd8245658d1707e59ef.tar.gz
libguestfs-78f1405de05ef1f2efebafd8245658d1707e59ef.tar.xz
libguestfs-78f1405de05ef1f2efebafd8245658d1707e59ef.zip
Use /var/tmp for the cached appliance (for FHS compliance).
The FHS advises large files not to be stored in the root filesystem[1], and that /var/tmp is persistent across reboots[2] (whereas /tmp is possibly not[3]). Therefore we should store the large cached supermin appliance in /var/tmp instead of /tmp. /tmp is still used for all other temporary files and directories. In either case you can override this by setting $TMPDIR. [1] http://www.pathname.com/fhs/pub/fhs-2.3.html#THEROOTFILESYSTEM [2] http://www.pathname.com/fhs/pub/fhs-2.3.html#VARTMPTEMPORARYFILESPRESERVEDBETWEE [3] http://www.pathname.com/fhs/pub/fhs-2.3.html#TMPTEMPORARYFILES
Diffstat (limited to 'src/launch.c')
-rw-r--r--src/launch.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/launch.c b/src/launch.c
index e009aae1..a7a86b97 100644
--- a/src/launch.c
+++ b/src/launch.c
@@ -770,6 +770,7 @@ guestfs__launch (guestfs_h *g)
/* Return the location of the tmpdir (eg. "/tmp") and allow users
* to override it at runtime using $TMPDIR.
+ * http://www.pathname.com/fhs/pub/fhs-2.3.html#TMPTEMPORARYFILES
*/
const char *
guestfs_tmpdir (void)
@@ -788,6 +789,23 @@ guestfs_tmpdir (void)
return tmpdir;
}
+/* Return the location of the persistent tmpdir (eg. "/var/tmp") and
+ * allow users to override it at runtime using $TMPDIR.
+ * http://www.pathname.com/fhs/pub/fhs-2.3.html#VARTMPTEMPORARYFILESPRESERVEDBETWEE
+ */
+const char *
+guestfs___persistent_tmpdir (void)
+{
+ const char *tmpdir;
+
+ tmpdir = "/var/tmp";
+
+ const char *t = getenv ("TMPDIR");
+ if (t) tmpdir = t;
+
+ return tmpdir;
+}
+
/* Compute Y - X and return the result in milliseconds.
* Approximately the same as this code:
* http://www.mpp.mpg.de/~huber/util/timevaldiff.c