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

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


Added to TODO:

* Add checks for fclose() failure

---------------------------------------------------------------------------

Gavin Sherry wrote:
> On Fri, 30 May 2003, Tom Lane wrote:
>
> > 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.
>
> Yes. I think I brought that up in my original email. Heap access/WAL
> routines 'should not' suffer an fclose() problem because of
> fsync() calls. But this isn't necessarily the case for COPY.
>
> >
> > fclose failure on an open-for-read-only file seems like Assert()
> > material; it "can't happen".
>
> Right. If this generates an error, there are probably more serious issues.
>
> Gavin
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Srikanth M 2003-06-06 16:39:33 Result of a query(Need Help)
Previous Message Rod Taylor 2003-06-06 15:53:17 Re: Problems with renaming a column