| From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> | 
|---|---|
| To: | PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org> | 
| Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Philip Warner <pjw(at)rhyme(dot)com(dot)au>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Giles Lean <giles(at)nemeton(dot)com(dot)au> | 
| Subject: | Re: pg_dump and large files - is this a problem? | 
| Date: | 2002-10-22 21:37:39 | 
| Message-ID: | 200210222137.g9MLbdp06844@candle.pha.pa.us | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
Bruce Momjian wrote:
> > So I think we're wasting our time to debate whether we need to support
> > non-integral off_t ... let's just apply Bruce's version and wait to
> > see if anyone has a problem before doing more work.
> 
> I am concerned about one more thing.  On BSD/OS, we have off_t of quad
> (8 byte), but we don't have fseeko, so this call looks questionable:
> 
> 	if (fseeko(AH->FH, tctx->dataPos, SEEK_SET) != 0)
> 
> In this case, dataPos is off_t (8 bytes), while fseek only accepts long
> in that parameter (4 bytes).  When this code is hit, a file > 4 gigs
> will seek to the wrong offset, I am afraid.  Also, I don't understand
> why the compiler doesn't produce a warning.
> 
> I wonder if I should add a conditional test so this code is hit only if
> HAVE_FSEEKO is defined.  There is alternative code for all the non-zero
> fseeks.
Here is a patch that I think fixes the problem I outlined above.  If
there is no fseeko(), it will not call fseek with a non-zero offset
unless sizeof(off_t) <= sizeof(long).
-- 
  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
| Attachment | Content-Type | Size | 
|---|---|---|
| unknown_filename | text/plain | 1.3 KB | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2002-10-22 22:09:23 | Re: Memory leaks | 
| Previous Message | Greg Copeland | 2002-10-22 21:16:16 | Memory leaks |