Changes of 6-Sep-02 broke pg_restore's ability to recognize tar-format
files. Fix it.
This commit is contained in:
parent
21166170c8
commit
330b4e4215
@ -17,7 +17,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.49 2002/10/25 01:33:17 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.50 2003/02/01 19:29:16 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -309,7 +309,7 @@ extern void InitArchiveFmt_Files(ArchiveHandle *AH);
|
||||
extern void InitArchiveFmt_Null(ArchiveHandle *AH);
|
||||
extern void InitArchiveFmt_Tar(ArchiveHandle *AH);
|
||||
|
||||
extern int isValidTarHeader(char *header);
|
||||
extern bool isValidTarHeader(char *header);
|
||||
|
||||
extern OutputContext SetOutput(ArchiveHandle *AH, char *filename, int compression);
|
||||
extern void ResetOutput(ArchiveHandle *AH, OutputContext savedContext);
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.33 2003/01/10 23:49:06 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.34 2003/02/01 19:29:16 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 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user