summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>1998-07-27 05:22:11 +0000
committerderaadt <deraadt@openbsd.org>1998-07-27 05:22:11 +0000
commite13683cdee1755e4e10afa71c28babf9905ee57b (patch)
tree1dfe1c30d9ffe3cee21c1c98b6368a10fb17e8a4 /lib/libc
parentpull in string.h for memset() proto (diff)
downloadwireguard-openbsd-e13683cdee1755e4e10afa71c28babf9905ee57b.tar.xz
wireguard-openbsd-e13683cdee1755e4e10afa71c28babf9905ee57b.zip
clone mkstemp() setup in ../btree
Diffstat (limited to 'lib/libc')
-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);