Date: Tue, 6 Jun 2000 10:20:02 -0700 (PDT) From: mi@privatelabs.com To: freebsd-ports@FreeBSD.org Subject: Re: ports/19047: net/arpwatch patched to use tmpfile() instead of m ktemp() Message-ID: <200006061720.KAA23445@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR ports/19047; it has been noted by GNATS. From: mi@privatelabs.com To: Ade Lovett <ade@FreeBSD.org> Cc: freebsd-gnats-submit@FreeBSD.org Subject: Re: ports/19047: net/arpwatch patched to use tmpfile() instead of m ktemp() Date: Tue, 6 Jun 2000 13:09:35 -0400 (EDT) On 6 Jun, Ade Lovett wrote: = On Tue, Jun 06, 2000 at 09:40:02AM -0700, mi@privatelabs.com wrote: = > Because I need FILE * instead of a file descriptor and because I = > think the name tmpfile is easier to understand then mkstemp. = = int fd = mkstemp( blah-blah ); = FILE *fp = fdopen( fd, mode ); Yes, thanks for pointing out the obvious. I believe, it is also obvious that ``fp = tmpfile()'' is MUCH shorter and cleaner -- it does not even need the ``blah-blah'', mind you, which has to be a writable character string, and usually there is a strcpy involved there too. Please, tone down your responses. = And from tmpfile(3): = = BUGS: = These interfaces are provided for System V and ANSI compatibility = only. The mkstemp(3) interface is strongly preferred. = [...] = = Then go on and read about the race conditions etc.. use mkstemp(), = that's what it's there for. The fact that I happen to disagree with the man-page does not mean that I did not read it. I did. FreeBSD does not need to care: This implementation does not have these flaws, but portable software cannot depend on that. In particular, the tmpfile() interface should not be used in software expected to be used on other systems if there is any possibility that the user does not wish the temporary file to be publicly readable and writable. If other OSes have the poorly implemented tmpfile(), IMHO, it is their problem. My goal was to improve the BSD port of arpwatch. The software maintainers received the courtesy copy. -mi To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200006061720.KAA23445>