Re: Testing the return value of fclose() in the backend

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Testing the return value of fclose() in the backend
Date: 2003-05-31 03:36:10
Message-ID: 17549.1054352170@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2003-05-31 04:09:04 Re: default locale considered harmful? (was Re: [GENERAL]
Previous Message Bruce Momjian 2003-05-31 03:11:33 Re: Compressing Fields?