When the programmer is forced to handle return codes
Posted Dec 4, 2009 15:14 UTC (Fri) by
hppnq (guest, #14462)
In reply to:
When the programmer is forced to handle return codes by skitching
Parent article:
On the importance of return codes
A failing close() may indicate a whole range of problems. While the file descriptor is gone in any case, catching the error and taking appropriate measures is a very good idea in non-trivial cases. What is appropriate depends on the context, because you can close() anything that can be represented by a file descriptor. Not doing anything may result in data loss or corruption even if you have written an otherwise bug-free program, although probably it is more likely that a close() failure will point out some problem in your code.
Even if your program is not able to do something sensible, maybe the user or administrator is, so you should report the error.
(
Log in to post comments)