summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/tempnam.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>1996-08-25 10:11:02 +0000
committerderaadt <deraadt@openbsd.org>1996-08-25 10:11:02 +0000
commitfdaed31805398a3d78b467d35d49e1f240f7470a (patch)
tree891e62e6e172efe31e0ab52570cab9599e07e090 /lib/libc/stdio/tempnam.c
parentMakefile.in: break mandir creation out of install-dir; (diff)
downloadwireguard-openbsd-fdaed31805398a3d78b467d35d49e1f240f7470a.tar.xz
wireguard-openbsd-fdaed31805398a3d78b467d35d49e1f240f7470a.zip
use issetugid()
Diffstat (limited to 'lib/libc/stdio/tempnam.c')
-rw-r--r--lib/libc/stdio/tempnam.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/stdio/tempnam.c b/lib/libc/stdio/tempnam.c
index cc3c2e27186..5c7a8150955 100644
--- a/lib/libc/stdio/tempnam.c
+++ b/lib/libc/stdio/tempnam.c
@@ -32,7 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: tempnam.c,v 1.2 1996/08/19 08:33:08 tholo Exp $";
+static char rcsid[] = "$OpenBSD: tempnam.c,v 1.3 1996/08/25 10:11:08 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -56,7 +56,7 @@ tempnam(dir, pfx)
if (!pfx)
pfx = "tmp.";
- if (f = getenv("TMPDIR")) {
+ if (issetugid() && (f = getenv("TMPDIR"))) {
(void)snprintf(name, MAXPATHLEN, "%s%s%sXXXXXX", f,
*(f + strlen(f) - 1) == '/'? "": "/", pfx);
if (f = mktemp(name))