Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Shutting up a silly compiler warning
- X-seq: zsh-workers 9944
- From: Dan Nelson <dnelson@xxxxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- Subject: Re: Shutting up a silly compiler warning
- Date: Tue, 29 Feb 2000 13:37:26 -0600
- Cc: zsh-workers@xxxxxxxxxxxxxx
- In-reply-to: <1000229083954.ZM17896@xxxxxxxxxxxxxxxxxxxxxxx>; from "Bart Schaefer" on Tue Feb 29 08:39:54 GMT 2000
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <1000229083954.ZM17896@xxxxxxxxxxxxxxxxxxxxxxx>
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@xxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author