Bruno Haible <[EMAIL PROTECTED]> writes: > + /* Close standard error. This is simpler than fwriteerror_no_ebadf, > because > + upon failure we don't need an errno - all we can do at this point is to > + set an exit status. */ > + errno = 0; > + if (ferror (stderr) || fflush (stderr)) > + { > + fclose (stderr); > + _exit (exit_failure); > + } > + if (fclose (stderr) && errno != EBADF) > + _exit (exit_failure); > }
I like the basic idea. As I understand it this affects only programs that issue "warnings" (i.e., they output to stderr but then continue without affecting the exit status) but it's useful for that case. However, wouldn't this implementation be simpler? if (close_stream (stderr) != 0) _exit (exit_failure); At any rate let's wait until coreutils 6.3 gets out.