Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit330b4e4

Browse files
committed
Changes of 6-Sep-02 broke pg_restore's ability to recognize tar-format
files. Fix it.
1 parent2116617 commit330b4e4

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

‎src/bin/pg_dump/pg_backup_archiver.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*
1818
*
1919
* IDENTIFICATION
20-
*$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.49 2002/10/25 01:33:17 momjian Exp $
20+
*$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.50 2003/02/01 19:29:16 tgl Exp $
2121
*
2222
*-------------------------------------------------------------------------
2323
*/
@@ -309,7 +309,7 @@ extern void InitArchiveFmt_Files(ArchiveHandle *AH);
309309
externvoidInitArchiveFmt_Null(ArchiveHandle*AH);
310310
externvoidInitArchiveFmt_Tar(ArchiveHandle*AH);
311311

312-
externintisValidTarHeader(char*header);
312+
externboolisValidTarHeader(char*header);
313313

314314
externOutputContextSetOutput(ArchiveHandle*AH,char*filename,intcompression);
315315
externvoidResetOutput(ArchiveHandle*AH,OutputContextsavedContext);

‎src/bin/pg_dump/pg_backup_tar.c

Lines changed: 13 additions & 3 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.33 2003/01/10 23:49:06 tgl Exp $
19+
*$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.34 2003/02/01 19:29:16 tgl Exp $
2020
*
2121
*-------------------------------------------------------------------------
2222
*/
@@ -981,15 +981,25 @@ _tarChecksum(char *header)
981981
returnsum+256;/* Assume 8 blanks in checksum field */
982982
}
983983

984-
int
984+
bool
985985
isValidTarHeader(char*header)
986986
{
987987
intsum;
988988
intchk=_tarChecksum(header);
989989

990990
sscanf(&header[148],"%8o",&sum);
991991

992-
return (sum==chk&&strncmp(&header[257],"ustar ",7)==0);
992+
if (sum!=chk)
993+
return false;
994+
995+
/* POSIX format */
996+
if (strncmp(&header[257],"ustar00",7)==0)
997+
return true;
998+
/* older format */
999+
if (strncmp(&header[257],"ustar ",7)==0)
1000+
return true;
1001+
1002+
return false;
9931003
}
9941004

9951005
/* Given the member, write the TAR header & copy the file */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp