summaryrefslogtreecommitdiff
path: root/src/bin/pg_dump/pg_backup_tar.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2003-02-01 19:29:26 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2003-02-01 19:29:26 +0000
commit90ad65a8ab1ece173d5e1edfad0f79c8985f64b0 (patch)
treeccb5ceaa336b0fa33147c405443457cb75599848 /src/bin/pg_dump/pg_backup_tar.c
parentc80184552f7c98d777bc551102317153effa4ad6 (diff)
Changes of 6-Sep-02 broke pg_restore's ability to recognize tar-format
files. Fix it.
Diffstat (limited to 'src/bin/pg_dump/pg_backup_tar.c')
-rw-r--r--src/bin/pg_dump/pg_backup_tar.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/bin/pg_dump/pg_backup_tar.c b/src/bin/pg_dump/pg_backup_tar.c
index 84e45dfed8c..93293fe8058 100644
--- a/src/bin/pg_dump/pg_backup_tar.c
+++ b/src/bin/pg_dump/pg_backup_tar.c
@@ -16,7 +16,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.32.2.1 2003/01/10 23:51:46 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.32.2.2 2003/02/01 19:29:26 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -981,7 +981,7 @@ _tarChecksum(char *header)
return sum + 256; /* Assume 8 blanks in checksum field */
}
-int
+bool
isValidTarHeader(char *header)
{
int sum;
@@ -989,7 +989,17 @@ isValidTarHeader(char *header)
sscanf(&header[148], "%8o", &sum);
- return (sum == chk && strncmp(&header[257], "ustar ", 7) == 0);
+ if (sum != chk)
+ return false;
+
+ /* POSIX format */
+ if (strncmp(&header[257], "ustar00", 7) == 0)
+ return true;
+ /* older format */
+ if (strncmp(&header[257], "ustar ", 7) == 0)
+ return true;
+
+ return false;
}
/* Given the member, write the TAR header & copy the file */