Bruno Haible <[EMAIL PROTECTED]> writes:

> Hi Paul and Jim,
>
> It bothers me that in order to implement a basic functionality like the
> 'closeout' module, you need the __fpending module, which is not based on
> POSIX but rather a case-by-case hack for various platforms.
>
> Here is a proposed patch to lift this dependency. Instead of using
> __fpending, the code in fwriteerror.c looks at the return code of
> fflush.

fwriteerror has bothered me, since it sometimes writes more data in
order to determine what the error was, under the argument that the
stream's contents are garbage anyway.

The stream's contents aren't necessarily all garbage: it could be, for
example, that there was an fseek failure, but nothing was written.
And even if they are garbage, I have the willies about adding more
garbage, as someone might want to repair the damage, and we're making
more work for them.

Also, fwriteerror assumes stdout can be closed at most once, but
stdout can be closed and then reopened.

I agree with you that fpending is a hack, but is it a hack that
doesn't work?  What platforms doesn't it work on?

Here's another thought.  Perhaps we can modify close-stream so that it
uses fpending if fpending is available, but falls back on a less-nice
algorithm otherwise.


Reply via email to