summaryrefslogtreecommitdiffstats
path: root/fish/fish.h
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2010-09-24 18:54:37 +0100
committerRichard W.M. Jones <rjones@redhat.com>2010-09-24 19:25:06 +0100
commitc9c0ac7d362fd19214c2c5e5bb7dcd9059950887 (patch)
tree6e5b1b2888baaf0bdb3b65d91d5f6f5bbef22f9c /fish/fish.h
parent840536ea5a0568296dfd3e483442c76b93c5a949 (diff)
downloadlibguestfs-c9c0ac7d362fd19214c2c5e5bb7dcd9059950887.tar.gz
libguestfs-c9c0ac7d362fd19214c2c5e5bb7dcd9059950887.tar.xz
libguestfs-c9c0ac7d362fd19214c2c5e5bb7dcd9059950887.zip
Allow $TMPDIR to override most temporary directory uses.
Be more consistent in allowing the user to override use of the temporary directory by specifying $TMPDIR. Also prefer P_tmpdir macro (defined in <stdio.h>) if that is defined, rather than hard-coding "/tmp" for the fallback location.
Diffstat (limited to 'fish/fish.h')
-rw-r--r--fish/fish.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/fish/fish.h b/fish/fish.h
index b941c493..23403575 100644
--- a/fish/fish.h
+++ b/fish/fish.h
@@ -47,6 +47,11 @@
#define STRCASENEQLEN(a,b,n) (strncasecmp((a),(b),(n)) != 0)
#define STRPREFIX(a,b) (strncmp((a),(b),strlen((b))) == 0)
+#define TMP_TEMPLATE_ON_STACK(var) \
+ const char *ttos_tmpdir = guestfs_tmpdir (); \
+ char var[strlen (ttos_tmpdir) + 32]; \
+ sprintf (var, "%s/guestfishXXXXXX", ttos_tmpdir) \
+
/* in fish.c */
extern guestfs_h *g;
extern int read_only;