summaryrefslogtreecommitdiff
path: root/openbsd-compat/mktemp.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2002-09-11 10:29:11 +1000
committerDamien Miller <djm@mindrot.org>2002-09-11 10:29:11 +1000
commit71eb0c1550ec6ad10d29779df7a7f97c44000e3a (patch)
tree1cbfd081547bcf3bfcc26e17f2f4537a03ced5ff /openbsd-compat/mktemp.c
parentc34e03e4711cabffae3504bcfdac26b67250c45d (diff)
- (djm) Sync openbsd-compat with OpenBSD -current
Diffstat (limited to 'openbsd-compat/mktemp.c')
-rw-r--r--openbsd-compat/mktemp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/openbsd-compat/mktemp.c b/openbsd-compat/mktemp.c
index d69dc5c24..d256ee448 100644
--- a/openbsd-compat/mktemp.c
+++ b/openbsd-compat/mktemp.c
@@ -39,7 +39,7 @@
39#ifndef HAVE_MKDTEMP 39#ifndef HAVE_MKDTEMP
40 40
41#if defined(LIBC_SCCS) && !defined(lint) 41#if defined(LIBC_SCCS) && !defined(lint)
42static char rcsid[] = "$OpenBSD: mktemp.c,v 1.14 2002/01/02 20:18:32 deraadt Exp $"; 42static char rcsid[] = "$OpenBSD: mktemp.c,v 1.16 2002/05/27 18:20:45 millert Exp $";
43#endif /* LIBC_SCCS and not lint */ 43#endif /* LIBC_SCCS and not lint */
44 44
45#ifdef HAVE_CYGWIN 45#ifdef HAVE_CYGWIN
@@ -102,11 +102,11 @@ _gettemp(path, doopen, domkdir, slen)
102 return (0); 102 return (0);
103 } 103 }
104 pid = getpid(); 104 pid = getpid();
105 while (*trv == 'X' && pid != 0) { 105 while (trv >= path && *trv == 'X' && pid != 0) {
106 *trv-- = (pid % 10) + '0'; 106 *trv-- = (pid % 10) + '0';
107 pid /= 10; 107 pid /= 10;
108 } 108 }
109 while (*trv == 'X') { 109 while (trv >= path && *trv == 'X') {
110 char c; 110 char c;
111 111
112 pid = (arc4random() & 0xffff) % (26+26); 112 pid = (arc4random() & 0xffff) % (26+26);