diff options
| author | Tim Kientzle <kientzle@FreeBSD.org> | 2008-12-08 17:22:44 +0000 |
|---|---|---|
| committer | Tim Kientzle <kientzle@FreeBSD.org> | 2008-12-08 17:22:44 +0000 |
| commit | 18f815b95cf7c8cf5c67b12ddf72308a211c3d73 (patch) | |
| tree | 1c120678585252c88f1de692d7a2798bcdf9cc73 | |
| parent | 71fbac11b023a08a146e331f2f1c9f17f202fdae (diff) | |
Notes
| -rw-r--r-- | lib/libarchive/test/main.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/libarchive/test/main.c b/lib/libarchive/test/main.c index de48c884d413..1de2532b1b53 100644 --- a/lib/libarchive/test/main.c +++ b/lib/libarchive/test/main.c @@ -897,6 +897,7 @@ int main(int argc, char **argv) time_t now; char *refdir_alloc = NULL; char *progname, *p; + char *tmp; char tmpdir[256]; char tmpdir_timestamp[256]; @@ -916,6 +917,17 @@ int main(int argc, char **argv) testprog = getenv(ENVBASE); #endif + if (getenv("TMPDIR") != NULL) + tmp = getenv("TMPDIR"); + else if (getenv("TMP") != NULL) + tmp = getenv("TMP"); + else if (getenv("TEMP") != NULL) + tmp = getenv("TEMP"); + else if (getenv("TEMPDIR") != NULL) + tmp = getenv("TEMPDIR"); + else + tmp = "/tmp"; + /* Allow -d to be controlled through the environment. */ if (getenv(ENVBASE "_DEBUG") != NULL) dump_on_failure = 1; @@ -976,7 +988,8 @@ int main(int argc, char **argv) strftime(tmpdir_timestamp, sizeof(tmpdir_timestamp), "%Y-%m-%dT%H.%M.%S", localtime(&now)); - sprintf(tmpdir, "/tmp/%s.%s-%03d", progname, tmpdir_timestamp, i); + sprintf(tmpdir, "%s/%s.%s-%03d", tmp, progname, + tmpdir_timestamp, i); if (mkdir(tmpdir,0755) == 0) break; if (errno == EEXIST) |
