=item TMPDIR
-Location of temporary directory, defaults to C</tmp>.
+Location of temporary directory, defaults to C</tmp> except for the
+cached supermin appliance which defaults to C</var/tmp>.
If libguestfs was compiled to use the supermin appliance then the
real appliance is cached in this directory, shared between all
handles belonging to the same EUID. You can use C<$TMPDIR> to
-configure another directory to use in case C</tmp> is not large
+configure another directory to use in case C</var/tmp> is not large
enough.
=back
uid_t uid,
char **kernel, char **initrd, char **appliance)
{
- const char *tmpdir = guestfs_tmpdir ();
+ const char *tmpdir = guestfs___persistent_tmpdir ();
/* len must be longer than the length of any pathname we can
* generate in this function.
if (g->verbose)
guestfs___print_timestamped_message (g, "begin building supermin appliance");
- const char *tmpdir = guestfs_tmpdir ();
+ const char *tmpdir = guestfs___persistent_tmpdir ();
/* len must be longer than the length of any pathname we can
* generate in this function.
extern void *guestfs_safe_memdup (guestfs_h *g, void *ptr, size_t size);
extern char *guestfs_safe_asprintf (guestfs_h *g, const char *fs, ...)
__attribute__((format (printf,2,3)));
+extern const char *guestfs___persistent_tmpdir (void);
extern void guestfs___print_timestamped_argv (guestfs_h *g, const char *argv[]);
extern void guestfs___print_timestamped_message (guestfs_h *g, const char *fs, ...);
extern void guestfs___free_inspect_info (guestfs_h *g);
=item TMPDIR
-Location of temporary directory, defaults to C</tmp>.
+Location of temporary directory, defaults to C</tmp> except for the
+cached supermin appliance which defaults to C</var/tmp>.
If libguestfs was compiled to use the supermin appliance then the
real appliance is cached in this directory, shared between all
handles belonging to the same EUID. You can use C<$TMPDIR> to
-configure another directory to use in case C</tmp> is not large
+configure another directory to use in case C</var/tmp> is not large
enough.
=back
/* 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)
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