Commit 87e76d0d authored by Tom Lane's avatar Tom Lane

Fix portability problem (size_t != int).

parent 94d8a798
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_files.c,v 1.18 2002/09/04 20:31:34 momjian Exp $ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_files.c,v 1.19 2002/09/10 18:25:13 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -413,7 +413,7 @@ _WriteBuf(ArchiveHandle *AH, const void *buf, size_t len) ...@@ -413,7 +413,7 @@ _WriteBuf(ArchiveHandle *AH, const void *buf, size_t len)
res = fwrite(buf, 1, len, AH->FH); res = fwrite(buf, 1, len, AH->FH);
if (res != len) if (res != len)
die_horribly(AH, modulename, "write error in _WriteBuf (%d != %d)\n", res, len); die_horribly(AH, modulename, "write error in _WriteBuf (%lu != %lu)\n", (unsigned long) res, (unsigned long) len);
ctx->filePos += res; ctx->filePos += res;
return res; return res;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.29 2002/09/06 21:58:36 petere Exp $ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.30 2002/09/10 18:22:20 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1147,6 +1147,7 @@ _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER *th) ...@@ -1147,6 +1147,7 @@ _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER *th)
int sum, int sum,
chk; chk;
size_t len; size_t len;
unsigned long ullen;
off_t hPos; off_t hPos;
int i; int i;
bool gotBlock = false; bool gotBlock = false;
...@@ -1203,8 +1204,9 @@ _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER *th) ...@@ -1203,8 +1204,9 @@ _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER *th)
} }
} }
sscanf(&h[0], "%99s", &tag[0]); sscanf(&h[0], "%99s", tag);
sscanf(&h[124], "%12o", &len); sscanf(&h[124], "%12lo", &ullen);
len = (size_t) ullen;
sscanf(&h[148], "%8o", &sum); sscanf(&h[148], "%8o", &sum);
{ {
...@@ -1212,7 +1214,7 @@ _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER *th) ...@@ -1212,7 +1214,7 @@ _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER *th)
snprintf(buf, 100, INT64_FORMAT, (int64) hPos); snprintf(buf, 100, INT64_FORMAT, (int64) hPos);
ahlog(AH, 3, "TOC Entry %s at %s (length %lu, checksum %d)\n", ahlog(AH, 3, "TOC Entry %s at %s (length %lu, checksum %d)\n",
&tag[0], buf, (unsigned long) len, sum); tag, buf, (unsigned long) len, sum);
} }
if (chk != sum) if (chk != sum)
...@@ -1223,7 +1225,7 @@ _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER *th) ...@@ -1223,7 +1225,7 @@ _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER *th)
die_horribly(AH, modulename, die_horribly(AH, modulename,
"corrupt tar header found in %s " "corrupt tar header found in %s "
"(expected %d, computed %d) file position %s\n", "(expected %d, computed %d) file position %s\n",
&tag[0], sum, chk, buf); tag, sum, chk, buf);
} }
th->targetFile = strdup(tag); th->targetFile = strdup(tag);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment