diff options
author | Bruce Evans <bde@FreeBSD.org> | 1998-03-03 14:38:36 +0000 |
---|---|---|
committer | Bruce Evans <bde@FreeBSD.org> | 1998-03-03 14:38:36 +0000 |
commit | 87ad126763d493917fee2c79c30473c56750db3f (patch) | |
tree | 9b55d570bb7e54aa0bc37bce04b6f0b6dd760328 /lib | |
parent | 92924291158d113d5afeb7c4e7654f1ca45c1190 (diff) | |
download | src-87ad126763d493917fee2c79c30473c56750db3f.tar.gz src-87ad126763d493917fee2c79c30473c56750db3f.zip |
Fixed uninitialized pointer in previous commit. mktemp() was broken.
I noticed cvs core dumps and uncleaned cvs temporary files in /tmp.
Fixed ANSIisms.
Notes
Notes:
svn path=/head/; revision=34016
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/stdio/mktemp.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/libc/stdio/mktemp.c b/lib/libc/stdio/mktemp.c index 561952291fb7..1987d6978dac 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 == '/') { |