From owner-freebsd-ports Tue Jun 6 10:20: 5 2000 Delivered-To: freebsd-ports@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id C081337B575 for ; Tue, 6 Jun 2000 10:20:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id KAA23445; Tue, 6 Jun 2000 10:20:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Date: Tue, 6 Jun 2000 10:20:02 -0700 (PDT) Message-Id: <200006061720.KAA23445@freefall.freebsd.org> To: freebsd-ports@FreeBSD.org Cc: From: mi@privatelabs.com Subject: Re: ports/19047: net/arpwatch patched to use tmpfile() instead of m ktemp() Reply-To: mi@privatelabs.com Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR ports/19047; it has been noted by GNATS. From: mi@privatelabs.com To: Ade Lovett 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