summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/mktemp.c
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1998-03-03 14:38:36 +0000
committerbde <bde@FreeBSD.org>1998-03-03 14:38:36 +0000
commitb19f66b1cad92d9a346fe82e74cfacf3c6130182 (patch)
tree05e58d618973bfac566d21d3d00d8c8db34c3112 /lib/libc/stdio/mktemp.c
parent725d1ce5121949fda5ccf59bc7f6e4266806f68a (diff)
downloadFreeBSD-src-b19f66b1cad92d9a346fe82e74cfacf3c6130182.zip
FreeBSD-src-b19f66b1cad92d9a346fe82e74cfacf3c6130182.tar.gz
Fixed uninitialized pointer in previous commit. mktemp() was broken.
I noticed cvs core dumps and uncleaned cvs temporary files in /tmp. Fixed ANSIisms.
Diffstat (limited to 'lib/libc/stdio/mktemp.c')
-rw-r--r--lib/libc/stdio/mktemp.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/libc/stdio/mktemp.c b/lib/libc/stdio/mktemp.c
index 5619522..1987d69 100644
--- a/lib/libc/stdio/mktemp.c
+++ b/lib/libc/stdio/mktemp.c
@@ -36,7 +36,7 @@
static char sccsid[] = "@(#)mktemp.c 8.1 (Berkeley) 6/4/93";
#endif
static const char rcsid[] =
- "$Id: mktemp.c,v 1.7 1997/04/07 18:01:10 guido Exp $";
+ "$Id: mktemp.c,v 1.8 1998/02/13 02:13:24 imp Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -48,7 +48,9 @@ static const char rcsid[] =
#include <ctype.h>
#include <unistd.h>
-static int _gettemp(char *, int *, int);
+char *_mktemp __P((char *));
+
+static int _gettemp __P((char *, int *, int));
int
mkstemp(path)
@@ -66,8 +68,6 @@ mkdtemp(path)
return(_gettemp(path, (int *)NULL, 1) ? path : (char *)NULL);
}
-char *_mktemp(char *);
-
char *
_mktemp(path)
char *path;
@@ -120,13 +120,14 @@ _gettemp(path, doopen, domkdir)
c = (pid - 26) + 'a';
*trv-- = c;
}
+ start = trv + 1;
/*
* check the target directory; if you have six X's and it
* doesn't exist this runs for a *very* long time.
*/
if (doopen || domkdir) {
- for (start = trv + 1;; --trv) {
+ for (;; --trv) {
if (trv <= path)
break;
if (*trv == '/') {
OpenPOWER on IntegriCloud