From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13046 invoked from network); 29 Feb 2000 19:37:39 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 29 Feb 2000 19:37:39 -0000 Received: (qmail 27430 invoked by alias); 29 Feb 2000 19:37:33 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9944 Received: (qmail 27417 invoked from network); 29 Feb 2000 19:37:33 -0000 Date: Tue, 29 Feb 2000 13:37:26 -0600 From: Dan Nelson To: Bart Schaefer Cc: zsh-workers@sunsite.auc.dk Subject: Re: Shutting up a silly compiler warning Message-ID: <20000229133726.A91984@dan.emsphone.com> References: <1000229083954.ZM17896@candle.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1000229083954.ZM17896@candle.brasslantern.com>; from "Bart Schaefer" on Tue Feb 29 08:39:54 GMT 2000 In the last episode (Feb 29), Bart Schaefer said: > Jos Backus just reported this one to me, from the FreeBSD compiler: > > utils.o: In function `gettempname': > utils.o(.text+0x1bfa): warning: mktemp() possibly used unsafely; consider > using mkstemp() > > Zsh does NOT use mktemp() unsafely, and it can't use mkstemp() > because it sometimes wants to create a FIFO or other non-plain-file. (it being zsh, not mktemp(). This confused me the first time I read this :) > What's the way to get rid of this warning without actually changing > the code? Under FreeBSD, you can use the undocumented _mktemp() function to bypass the linker warning. I don't know if the other BSDs implement their warning message in the same way. Does OpenBSD print a similar warning for sprintf? :) char * _mktemp(char *path) { return(_gettemp(path, (int *)NULL, 0, 0) ? path : (char *)NULL); } __warn_references(mktemp, "warning: mktemp() possibly used unsafely; consider using mkstemp()"); char * mktemp(char *path) { return(_mktemp(path)); } -- Dan Nelson dnelson@emsphone.com