Fix for fseeko.c and pg_dump -Ft - Mailing list pgsql-patches

From Bruce Momjian
Subject Fix for fseeko.c and pg_dump -Ft
Date
Msg-id 200403230530.i2N5UBY21732@candle.pha.pa.us
Whole thread Raw
List pgsql-patches
I just fixed a problem with our port/fseeko.c code.

I added an fflush() so the FILE buffer would update the file descriptor
so stat() gets proper size in fseeko.c.

This fixes a problem with pg_dump tar backups.  Only happens on
platforms that use our port/fseeko.c, which is currently BSD/OS and
NetBSD.  The error would be:

    $ pg_dump -Ft test >/dev/null
    pg_dump: [tar archiver] actual file length (2171) does not match
    expected (2171)

Backpatched to 7.4.X too.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/port/fseeko.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/port/fseeko.c,v
retrieving revision 1.13
diff -c -c -r1.13 fseeko.c
*** src/port/fseeko.c    29 Nov 2003 19:52:13 -0000    1.13
--- src/port/fseeko.c    23 Mar 2004 05:24:52 -0000
***************
*** 68,73 ****
--- 68,74 ----
  #ifdef bsdi
              flockfile(stream);
  #endif
+             fflush(stream);    /* force writes to fd for stat() */
              if (fstat(fileno(stream), &filestat) != 0)
                  goto failure;
              floc = filestat.st_size;

pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: charset / postmaster doc improv
Next
From: Neil Conway
Date:
Subject: Re: charset / postmaster doc improv