diff options
author | Werner Koch <wk@gnupg.org> | 2010-10-27 09:37:52 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2010-10-27 09:37:52 +0200 |
commit | dc5150db782b2b7675957c24cda8098957296315 (patch) | |
tree | f217d218f37a10d121dde36af6962a373fe7f972 /tools | |
parent | Update scripts etc. (diff) | |
download | gnupg2-dc5150db782b2b7675957c24cda8098957296315.tar.xz gnupg2-dc5150db782b2b7675957c24cda8098957296315.zip |
Honor TMPDIR.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/ChangeLog | 4 | ||||
-rw-r--r-- | tools/symcryptrun.c | 10 |
2 files changed, 12 insertions, 2 deletions
diff --git a/tools/ChangeLog b/tools/ChangeLog index 84fbe4098..5ffa9f47d 100644 --- a/tools/ChangeLog +++ b/tools/ChangeLog @@ -1,3 +1,7 @@ +2010-10-27 Werner Koch <wk@g10code.com> + + * symcryptrun.c (confucius_mktmpdir): Use TMPDIR. + 2010-10-14 Werner Koch <wk@g10code.com> * gpg-connect-agent.c: Add option --agent-program. diff --git a/tools/symcryptrun.c b/tools/symcryptrun.c index 2ef682210..438ed459c 100644 --- a/tools/symcryptrun.c +++ b/tools/symcryptrun.c @@ -303,9 +303,15 @@ remove_file (char *name, int shred) static char * confucius_mktmpdir (void) { - char *name; + char *name, *p; - name = strdup ("/tmp/gpg-XXXXXX"); + p = getenv ("TMPDIR"); + if (!p || !*p) + p = "/tmp"; + if (p[strlen (p) - 1] == '/') + name = xstrconcat (p, "gpg-XXXXXX", NULL); + else + name = xstrconcat (p, "/", "gpg-XXXXXX", NULL); if (!name || !mkdtemp (name)) { log_error (_("can't create temporary directory `%s': %s\n"), |