From 90ad65a8ab1ece173d5e1edfad0f79c8985f64b0 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 1 Feb 2003 19:29:26 +0000 Subject: Changes of 6-Sep-02 broke pg_restore's ability to recognize tar-format files. Fix it. --- src/bin/pg_dump/pg_backup_tar.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/bin/pg_dump/pg_backup_tar.c') 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 */ -- cgit v1.2.3