aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2020-03-29 09:25:40 +0200
committerPeter Eisentraut <peter@eisentraut.org>2020-03-29 09:25:40 +0200
commit9cedb1666051516c2763bb0ae4ace583cd26b141 (patch)
treefea281596466dea6af7cf879317440a60bc8fb3c /src
parentb79911dc8c0dc3b864999b9a17333716d602c6a0 (diff)
downloadpostgresql-9cedb1666051516c2763bb0ae4ace583cd26b141.tar.gz
postgresql-9cedb1666051516c2763bb0ae4ace583cd26b141.zip
pg_regress: Observe TMPDIR
Put the temporary socket directory under TMPDIR, if that environment variable is set, instead of the hardcoded /tmp. This allows running the tests if there is no /tmp at all (for example on Windows, although running the tests with Unix-domain sockets is not enabled on Windows yet). We also use TMPDIR everywhere else /tmp is hardcoded, so this makes the behavior consistent. Reviewed-by: Andrew Dunstan <andrew.dunstan@2ndquadrant.com> Discussion: https://www.postgresql.org/message-id/flat/54bde68c-d134-4eb8-5bd3-8af33b72a010@2ndquadrant.com
Diffstat (limited to 'src')
-rw-r--r--src/test/regress/pg_regress.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c
index 6bc19b9668d..1e2aa486547 100644
--- a/src/test/regress/pg_regress.c
+++ b/src/test/regress/pg_regress.c
@@ -330,7 +330,8 @@ signal_remove_temp(int signum)
static const char *
make_temp_sockdir(void)
{
- char *template = pg_strdup("/tmp/pg_regress-XXXXXX");
+ char *template = psprintf("%s/pg_regress-XXXXXX",
+ getenv("TMPDIR") ? getenv("TMPDIR") : "/tmp");
temp_sockdir = mkdtemp(template);
if (temp_sockdir == NULL)