Messages in this thread | | | Date | Thu, 18 Jul 2002 11:32:33 -0400 | From | Sandy Harris <> | Subject | Re: close return value |
| |
"Richard B. Johnson" wrote: > > On 18 Jul 2002, Patrick J. LoPresti wrote: > > > Pete Zaitcev <zaitcev@redhat.com> writes: > > > > > The problem with errors from close() is that NOTHING SMART can be > > > done by the application when it receives it. > > > > This is like saying "nothing smart" can be done when write() returns > > ENOSPC. Such statements are either trivially true or blatantly false, > > depending on what you mean by "smart". > > > > Failures happen. They can happen on write(), they can happen on > > close(), and they can happen on any system call for which the API > > allows it. There is no difference! Your application either deals > > with them and is correct or fails to deal with them and is broken. > > > > If the API allows an error return, you *must* check for it, period. > [SNIPPED..] > > Well no. Many procedures are called for effect. When is the last > time you checked the return-value of printf() or puts()? If your > code does this it's wasting CPU cycles.
There's a classic paper on this: http://www.apocalypse.org/pub/u/paul/docs/canthappen.html - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |