bug-gnulib
[Top][All Lists]
Advanced

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

Re: [Bug-gnulib] closeout doesn't always close: which is better: always


From: Paul Eggert
Subject: Re: [Bug-gnulib] closeout doesn't always close: which is better: always or never?
Date: Sat, 06 Nov 2004 12:00:12 -0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Jim Meyering <address@hidden> writes:

> Never closing seems slightly cleaner, but if there's a way in which
> a subsequent close can fail, then always closing would be better.

There is a way, I think.  For example, some NFS implementations have a
local stable cache to hold the result of write() calls, so that
write() can return right away instead of waiting for a round-trip from
the NFS server.  But this means that fflush can succeed -- because all
it does is write() -- even though an immediately following fclose can
fail, because fclose calls close(), and close() checks that the data
actually got to the server, and close() reports the failure of the
recent write()).  This is why close() can fail with errno==ENOSPC on
Solaris, for example.

So from that point of view it sounds like always-closing would be better.

> Taking the other side, maybe it's better always to close, just
> to be sure that if post-close_stdout code attempts further output
> it'll fail.

That also makes sense to me.




reply via email to

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