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

Commitce93521

Browse files
committed
Guard against duplicate IDs in input file in SortTocFromFile().
Per report from Brian Hackett.
1 parent6a36111 commitce93521

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

‎src/bin/pg_dump/pg_backup_archiver.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
*
1717
* IDENTIFICATION
18-
*$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.42.2.1 2005/04/30 09:08:14 neilc Exp $
18+
*$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.42.2.2 2005/05/17 17:31:24 tgl Exp $
1919
*
2020
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au
2121
*
@@ -982,7 +982,7 @@ SortTocFromFile(Archive *AHX, RestoreOptions *ropt)
982982
if (!fh)
983983
die_horribly(AH,modulename,"could not open TOC file\n");
984984

985-
while (fgets(buf,1024,fh)!=NULL)
985+
while (fgets(buf,sizeof(buf),fh)!=NULL)
986986
{
987987
/* Find a comment */
988988
cmnt=strchr(buf,';');
@@ -1010,10 +1010,13 @@ SortTocFromFile(Archive *AHX, RestoreOptions *ropt)
10101010
if (!te)
10111011
die_horribly(AH,modulename,"could not find entry for id %d\n",id);
10121012

1013-
ropt->idWanted[id-1]=1;
1013+
if (!ropt->idWanted[id-1])
1014+
{
1015+
ropt->idWanted[id-1]=1;
10141016

1015-
_moveAfter(AH,tePrev,te);
1016-
tePrev=te;
1017+
_moveAfter(AH,tePrev,te);
1018+
tePrev=te;
1019+
}
10171020
}
10181021

10191022
if (fclose(fh)!=0)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp