bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: proposed change to close-stream module


From: Paul Eggert
Subject: Re: proposed change to close-stream module
Date: Fri, 29 Sep 2006 10:30:27 -0700
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

Bruno Haible <address@hidden> 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

[Prev in Thread] Current Thread [Next in Thread]