summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1998-07-27 05:22:12 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1998-07-27 05:22:12 +0000
commit14d5b2107792579ba0954ef15dca643b4143f2fb (patch)
treed58179fa2d045c2a2fa0b14d4d13eb7bde88ada7 /lib
parent127e00df03ee512323321b3be121f9d2ecef7a29 (diff)
clone mkstemp() setup in ../btree
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/db/hash/hash_page.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/libc/db/hash/hash_page.c b/lib/libc/db/hash/hash_page.c
index 879d788247f..0ca6485e2d8 100644
--- a/lib/libc/db/hash/hash_page.c
+++ b/lib/libc/db/hash/hash_page.c
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: hash_page.c,v 1.3 1996/08/19 08:20:39 tholo Exp $";
+static char rcsid[] = "$OpenBSD: hash_page.c,v 1.4 1998/07/27 05:22:11 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
/*
@@ -860,7 +860,13 @@ open_temp(hashp)
HTAB *hashp;
{
sigset_t set, oset;
- static char namestr[] = "_hashXXXXXX";
+ char *envtmp = NULL;
+ char path[MAXPATHLEN];
+
+ if (issetugid() == 0)
+ envtmp = getenv("TMPDIR");
+ (void)snprintf(path,
+ sizeof(path), "%s/_hash.XXXXXX", envtmp ? envtmp : "/tmp");
/* Block signals; make sure file goes away at process exit. */
(void)sigfillset(&set);