Date: Sun, 04 Apr 1999 14:26:07 -0600 From: Warner Losh <imp@harmony.village.org> To: obrien@NUXI.com Cc: current@FreeBSD.ORG Subject: Re: World Breakage? Message-ID: <199904042026.OAA31920@harmony.village.org> In-Reply-To: Your message of "Sun, 04 Apr 1999 13:21:14 PDT." <19990404132114.C77056@nuxi.com> References: <19990404132114.C77056@nuxi.com> <19990404093848.A76160@nuxi.com> <19990403222515.A75073@nuxi.com> <19990404093848.A76160@nuxi.com> <199904041912.NAA84643@harmony.village.org>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <19990404132114.C77056@nuxi.com> "David O'Brien" writes: : I can't duplicate this problem. Just to be sure... you aren't using : -DNOCLEAN, -O2 or anything like that, right? : : Would it be possible for you to take the March 31st CURRENT snapshot, do : a fresh CVSup/cvs checkout and try a build? I already have mkstemps in my tree. I had imported it from OpenBSD a while ago, but hadn't committed it. I'll do that now, as well as remove the mktemp.c from the offending makefile. It works w/o it and eliminates an XXX comment. So you shouldn't be able to reproduce this in a clean tree. :-) Warner P.S. here's what I have in my tree that I'll commit soon. Index: mktemp.c =================================================================== RCS file: /home/imp/FreeBSD/CVS/src/lib/libc/stdio/mktemp.c,v retrieving revision 1.12 diff -d -u -r1.12 mktemp.c --- mktemp.c 1998/10/20 15:33:21 1.12 +++ mktemp.c 1999/04/04 19:31:50 @@ -50,29 +50,39 @@ char *_mktemp __P((char *)); -static int _gettemp __P((char *, int *, int)); +static int _gettemp __P((char *, int *, int, int)); int +mkstemps(path, slen) + char *path; + int slen; +{ + int fd; + + return (_gettemp(path, &fd, 0, slen) ? fd : -1); +} + +int mkstemp(path) char *path; { int fd; - return (_gettemp(path, &fd, 0) ? fd : -1); + return (_gettemp(path, &fd, 0, 0) ? fd : -1); } char * mkdtemp(path) char *path; { - return(_gettemp(path, (int *)NULL, 1) ? path : (char *)NULL); + return(_gettemp(path, (int *)NULL, 1, 0) ? path : (char *)NULL); } char * _mktemp(path) char *path; { - return(_gettemp(path, (int *)NULL, 0) ? path : (char *)NULL); + return(_gettemp(path, (int *)NULL, 0, 0) ? path : (char *)NULL); } #ifdef UNSAFE_WARN @@ -88,12 +98,13 @@ } static int -_gettemp(path, doopen, domkdir) +_gettemp(path, doopen, domkdir, slen) char *path; register int *doopen; int domkdir; + int slen; { - register char *start, *trv; + register char *start, *trv, *suffp; struct stat sbuf; int pid, rval; @@ -105,7 +116,13 @@ pid = getpid(); for (trv = path; *trv; ++trv) ; + trv -= slen; + suffp = trv; --trv; + if (trv < path) { + errno = EINVAL; + return (0); + } while (*trv == 'X' && pid != 0) { *trv-- = (pid % 10) + '0'; pid /= 10; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199904042026.OAA31920>