On Wed, Apr 11, 2012 at 21:59, Jim Warner <james.warner@xxxxxxxxxxx> wrote: > As for your proposed fileutils/close-stream changes, here are > some (unsolicited) thoughts: > > * Isn't this "problem" really a deficiency in the C standards? You might be right. If you want to do something about the standard submit proposal to austin group. Eric Blake recently replied to coreutils list how to do that. http://permalink.gmane.org/gmane.comp.gnu.coreutils.general/2562 > * If not addressed there, shouldn't it be taken up by the glibc > folks? Possibly not. My feeling is that libc guys will not want to trace whether at exit something should be closed & checked. If such should happen automatically I guess the task should be done software destroying the process, e.g. usually kernel. > * A program didn't open those streams, so it's awfully unfair to require > closure. Yup, that is a C gotcha. > * Such stream close errors seem to be limited to induced constraints. Now my English is failing me. Did you mean buffered streams are evil, as they might fail invisibly unless explicitly checked. > * An exception is disk full, but then a zero rc is the least of > a user's problems. Or broken disk, corrupted file system or 'insert here a cause why IO would fail'. > * Has there ever been a hint of a problem related to a "misleading" zero > rc? Lack of evidence does not validate nor falsify theory. I do not see any reason why software should not return non-zero value when IO fails, even if that is _very_ rare condition. > Ok, with that said let me also say I appreciate the minimally intrusive > manor of your and Jim Meyering's implementation. But, perhaps your > close_stdout() function could be called something like close_outstreams() > since it's not limited to solely stdout. That is the function name in gnulib. Keeping name space in sync has some sense, renaming to more suitable string is reasonable from other point of view. Lets get third opinion from Craig whether to rename or not. -- Sami Kerola http://www.iki.fi/kerolasa/