Re: Testing the return value of fclose() in the backend - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Testing the return value of fclose() in the backend
Date
Msg-id 17549.1054352170@sss.pgh.pa.us
Whole thread Raw
In response to Re: Testing the return value of fclose() in the backend  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: Testing the return value of fclose() in the backend
List pgsql-hackers
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Gavin Sherry wrote:
>> There are various places in the backend, such as FreeFile(), where the
>> return value of fclose() is not tested.

> We are not checking fclose, probably because fclose failures are quite
> rare.  Should we be concerned?

Probably.  Closing a valid file descriptor in itself can't provoke any
error that I can imagine, but fclose() also implies fflush() --- so if
you have written data that hasn't yet been forced out of the stdio
buffers then out-of-disk-space is certainly a foreseeable failure.

fclose failure on an open-for-read-only file seems like Assert()
material; it "can't happen".
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Compressing Fields?
Next
From: Bruce Momjian
Date:
Subject: Re: default locale considered harmful? (was Re: [GENERAL]