From owner-freebsd-hackers Thu Nov 23 21:29:26 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from homer.softweyr.com (frankenrouter.softweyr.com [204.68.178.1]) by hub.freebsd.org (Postfix) with ESMTP id E01EF37B479 for ; Thu, 23 Nov 2000 21:29:23 -0800 (PST) Received: from [127.0.0.1] (helo=softweyr.com ident=Fools trust ident!) by homer.softweyr.com with esmtp (Exim 3.16 #1) id 13ypcM-0002I9-00; Wed, 22 Nov 2000 23:12:22 -0700 Message-ID: <3A1CB545.647AC073@softweyr.com> Date: Wed, 22 Nov 2000 23:12:21 -0700 From: Wes Peters Organization: Softweyr LLC X-Mailer: Mozilla 4.75 [en] (X11; U; Linux 2.2.12 i386) X-Accept-Language: en MIME-Version: 1.0 To: Matt Dillon Cc: Robert Nordier , "Daniel C. Sobral" , Garance A Drosihn , hackers@FreeBSD.ORG Subject: Re: fclose vs ferror (from libc/getcap) References: <200011221225.OAA04292@siri.nordier.com> <200011221736.eAMHaBK13156@earth.backplane.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Matt Dillon wrote: > > [...] > > In today's world the standard is: When you free() something, that's it.. > it's gone. When you fclose() something or otherwise terminate a > structure, it's gone. Anything else is illegal. *internally* our libc > assumes that ferror() is legal after an fclose() because, well, it's > true... but only for internal library functions. Nobody outside the > library can legally make that assumption and it could also be argued > that even within the library those types of assumptions should not be > made unless absolutely necessary. > > There isn't much we can do about the issue except fix the instances > of mis-programming as they show up. An excellent summary of what is and what should be. If we wanted to be anally retentive, we could bzero the FILE after completing the close() operation, just to "help" poorly written programs core... -- "Where am I, and what am I doing in this handbasket?" Wes Peters Softweyr LLC wes@softweyr.com http://softweyr.com/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message