Date: Wed, 22 Nov 2000 23:12:21 -0700 From: Wes Peters <wes@softweyr.com> To: Matt Dillon <dillon@earth.backplane.com> Cc: Robert Nordier <rnordier@nordier.com>, "Daniel C. Sobral" <dcs@newsguy.com>, Garance A Drosihn <drosih@rpi.edu>, hackers@FreeBSD.ORG Subject: Re: fclose vs ferror (from libc/getcap) Message-ID: <3A1CB545.647AC073@softweyr.com> References: <200011221225.OAA04292@siri.nordier.com> <200011221736.eAMHaBK13156@earth.backplane.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3A1CB545.647AC073>