*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.47 2005/01/25 22:44:31 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.48 2005/06/22 02:00:47 neilc Exp $
*
*-------------------------------------------------------------------------
*/
size_t len;
unsigned long ullen;
off_t hPos;
- int i;
bool gotBlock = false;
while (!gotBlock)
hPos = ctx->tarFHpos;
/* Read a 512 byte block, return EOF, exit if short */
- len = _tarReadRaw(AH, &h[0], 512, NULL, ctx->tarFH);
+ len = _tarReadRaw(AH, h, 512, NULL, ctx->tarFH);
if (len == 0) /* EOF */
return 0;
(unsigned long) len);
/* Calc checksum */
- chk = _tarChecksum(&h[0]);
+ chk = _tarChecksum(h);
+ sscanf(&h[148], "%8o", &sum);
/*
- * If the checksum failed, see if it is a null block. If so, then
- * just try with next block...
+ * If the checksum failed, see if it is a null block. If so,
+ * silently continue to the next block.
*/
-
if (chk == sum)
gotBlock = true;
else
{
+ int i;
+
for (i = 0; i < 512; i++)
{
- if (h[0] != 0)
+ if (h[i] != 0)
{
gotBlock = true;
break;
sscanf(&h[0], "%99s", tag);
sscanf(&h[124], "%12lo", &ullen);
len = (size_t) ullen;
- sscanf(&h[148], "%8o", &sum);
{
char buf[100];