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 /scd/scdaemon.c | |
parent | Update scripts etc. (diff) | |
download | gnupg2-dc5150db782b2b7675957c24cda8098957296315.tar.xz gnupg2-dc5150db782b2b7675957c24cda8098957296315.zip |
Honor TMPDIR.
Diffstat (limited to 'scd/scdaemon.c')
-rw-r--r-- | scd/scdaemon.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/scd/scdaemon.c b/scd/scdaemon.c index 741b6d279..da1d7f478 100644 --- a/scd/scdaemon.c +++ b/scd/scdaemon.c @@ -731,7 +731,7 @@ main (int argc, char **argv ) { socket_name = create_socket_name (standard_socket, "S.scdaemon", - "/tmp/gpg-XXXXXX/S.scdaemon"); + "gpg-XXXXXX/S.scdaemon"); fd = FD2INT(create_server_socket (standard_socket, socket_name, &socket_nonce)); @@ -780,7 +780,7 @@ main (int argc, char **argv ) /* Create the socket. */ socket_name = create_socket_name (standard_socket, "S.scdaemon", - "/tmp/gpg-XXXXXX/S.scdaemon"); + "gpg-XXXXXX/S.scdaemon"); fd = FD2INT (create_server_socket (standard_socket, socket_name, &socket_nonce)); @@ -1019,7 +1019,15 @@ create_socket_name (int use_standard_socket, name = make_filename (opt.homedir, standard_name, NULL); else { - name = xstrdup (template); + /* Prepend the tmp directory to the template. */ + p = getenv ("TMPDIR"); + if (!p || !*p) + p = "/tmp"; + if (p[strlen (p) - 1] == '/') + name = xstrconcat (p, template, NULL); + else + name = xstrconcat (p, "/", template, NULL); + p = strrchr (name, '/'); if (!p) BUG (); |