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

Commitdfb1e9b

Browse files
committed
Further pg_dump / ftello improvements
Make ftello error-checking consistent to all calls and remove abit of ftello-related code which has been #if 0'd out since 2001.Note that we are not concerned with the ftello() call undersnprintf() failing as it is just building a string to callexit_horribly() with; printing -1 in such a case is fine.
1 parent5e8e794 commitdfb1e9b

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

‎src/bin/pg_dump/pg_backup_archiver.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3347,9 +3347,8 @@ checkSeek(FILE *fp)
33473347
#endif
33483348

33493349
/* Check that ftello works on this file */
3350-
errno=0;
33513350
tpos=ftello(fp);
3352-
if (errno)
3351+
if (tpos<0)
33533352
return false;
33543353

33553354
/*

‎src/bin/pg_dump/pg_backup_tar.c

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,6 +1068,9 @@ _tarAddFile(ArchiveHandle *AH, TAR_MEMBER *th)
10681068
*/
10691069
fseeko(tmp,0,SEEK_END);
10701070
th->fileLen=ftello(tmp);
1071+
if (th->fileLen<0)
1072+
exit_horribly(modulename,"could not determine seek position in file: %s\n",
1073+
strerror(errno));
10711074
fseeko(tmp,0,SEEK_SET);
10721075

10731076
/*
@@ -1212,20 +1215,6 @@ _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER *th)
12121215

12131216
while (!gotBlock)
12141217
{
1215-
#if0
1216-
if (ftello(ctx->tarFH)!=ctx->tarFHpos)
1217-
{
1218-
charbuf1[100],
1219-
buf2[100];
1220-
1221-
snprintf(buf1,sizeof(buf1),INT64_FORMAT, (int64)ftello(ctx->tarFH));
1222-
snprintf(buf2,sizeof(buf2),INT64_FORMAT, (int64)ftello(ctx->tarFHpos));
1223-
exit_horribly(modulename,
1224-
"mismatch in actual vs. predicted file position (%s vs. %s)\n",
1225-
buf1,buf2);
1226-
}
1227-
#endif
1228-
12291218
/* Save the pos for reporting purposes */
12301219
hPos=ctx->tarFHpos;
12311220

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp