Skip to content

Commit 87e76d0

Browse files
committed
Fix portability problem (size_t != int).
1 parent 94d8a79 commit 87e76d0

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/bin/pg_dump/pg_backup_files.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*
2121
*
2222
* IDENTIFICATION
23-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_files.c,v 1.18 2002/09/04 20:31:34 momjian Exp $
23+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_files.c,v 1.19 2002/09/10 18:25:13 tgl Exp $
2424
*
2525
*-------------------------------------------------------------------------
2626
*/
@@ -413,7 +413,7 @@ _WriteBuf(ArchiveHandle *AH, const void *buf, size_t len)
413413

414414
res = fwrite(buf, 1, len, AH->FH);
415415
if (res != len)
416-
die_horribly(AH, modulename, "write error in _WriteBuf (%d != %d)\n", res, len);
416+
die_horribly(AH, modulename, "write error in _WriteBuf (%lu != %lu)\n", (unsigned long) res, (unsigned long) len);
417417

418418
ctx->filePos += res;
419419
return res;

src/bin/pg_dump/pg_backup_tar.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
*
1818
* IDENTIFICATION
19-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.29 2002/09/06 21:58:36 petere Exp $
19+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.30 2002/09/10 18:22:20 tgl Exp $
2020
*
2121
*-------------------------------------------------------------------------
2222
*/
@@ -1147,6 +1147,7 @@ _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER *th)
11471147
int sum,
11481148
chk;
11491149
size_t len;
1150+
unsigned long ullen;
11501151
off_t hPos;
11511152
int i;
11521153
bool gotBlock = false;
@@ -1203,16 +1204,17 @@ _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER *th)
12031204
}
12041205
}
12051206

1206-
sscanf(&h[0], "%99s", &tag[0]);
1207-
sscanf(&h[124], "%12o", &len);
1207+
sscanf(&h[0], "%99s", tag);
1208+
sscanf(&h[124], "%12lo", &ullen);
1209+
len = (size_t) ullen;
12081210
sscanf(&h[148], "%8o", &sum);
12091211

12101212
{
12111213
char buf[100];
12121214

12131215
snprintf(buf, 100, INT64_FORMAT, (int64) hPos);
12141216
ahlog(AH, 3, "TOC Entry %s at %s (length %lu, checksum %d)\n",
1215-
&tag[0], buf, (unsigned long) len, sum);
1217+
tag, buf, (unsigned long) len, sum);
12161218
}
12171219

12181220
if (chk != sum)
@@ -1223,7 +1225,7 @@ _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER *th)
12231225
die_horribly(AH, modulename,
12241226
"corrupt tar header found in %s "
12251227
"(expected %d, computed %d) file position %s\n",
1226-
&tag[0], sum, chk, buf);
1228+
tag, sum, chk, buf);
12271229
}
12281230

12291231
th->targetFile = strdup(tag);

0 commit comments

Comments
 (0)