diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2010-09-24 18:54:37 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2010-09-24 19:25:06 +0100 |
commit | c9c0ac7d362fd19214c2c5e5bb7dcd9059950887 (patch) | |
tree | 6e5b1b2888baaf0bdb3b65d91d5f6f5bbef22f9c /test-tool | |
parent | 840536ea5a0568296dfd3e483442c76b93c5a949 (diff) | |
download | libguestfs-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 'test-tool')
-rw-r--r-- | test-tool/test-tool.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/test-tool/test-tool.c b/test-tool/test-tool.c index 223cafca..7b49dbec 100644 --- a/test-tool/test-tool.c +++ b/test-tool/test-tool.c @@ -60,12 +60,16 @@ #define STRCASENEQLEN(a,b,n) (strncasecmp((a),(b),(n)) != 0) #define STRPREFIX(a,b) (strncmp((a),(b),strlen((b))) == 0) +#ifndef P_tmpdir +#define P_tmpdir "/tmp" +#endif + #define DEFAULT_TIMEOUT 120 static const char *helper = DEFAULT_HELPER; static int timeout = DEFAULT_TIMEOUT; -static char tmpf[] = "/tmp/libguestfs-test-tool-sda-XXXXXX"; -static char isof[] = "/tmp/libguestfs-test-tool-iso-XXXXXX"; +static char tmpf[] = P_tmpdir "/libguestfs-test-tool-sda-XXXXXX"; +static char isof[] = P_tmpdir "/libguestfs-test-tool-iso-XXXXXX"; static guestfs_h *g; static void preruncheck (void); @@ -269,7 +273,7 @@ main (int argc, char *argv[]) exit (EXIT_SUCCESS); } -static char qemuwrapper[] = "/tmp/libguestfs-test-tool-wrapper-XXXXXX"; +static char qemuwrapper[] = P_tmpdir "/libguestfs-test-tool-wrapper-XXXXXX"; static void cleanup_wrapper (void) |