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

Commite03485a

Browse files
committed
Fix case of pg_dump -Fc to an unseekable file (such as a pipe).
This was accidentally broken in commitscfa1b4a/5e8e794e3b.It saves a line or so to call ftello unconditionally in _CloseArchive,but we have to expect that it might fail if we're not in hasSeek mode.Per report from Bernd Helmle.In passing, improve _getFilePos to print an appropriate message ifftello fails unexpectedly, rather than just a vague complaint about"ftell mismatch".
1 parentf8db074 commite03485a

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

‎src/bin/pg_dump/pg_backup_custom.c

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -707,8 +707,9 @@ _CloseArchive(ArchiveHandle *AH)
707707
if (AH->mode==archModeWrite)
708708
{
709709
WriteHead(AH);
710+
/* Remember TOC's seek position for use below */
710711
tpos=ftello(AH->FH);
711-
if (tpos<0)
712+
if (tpos<0&&ctx->hasSeek)
712713
exit_horribly(modulename,"could not determine seek position in archive file: %s\n",
713714
strerror(errno));
714715
WriteToc(AH);
@@ -899,17 +900,20 @@ _getFilePos(ArchiveHandle *AH, lclContext *ctx)
899900

900901
if (ctx->hasSeek)
901902
{
903+
/*
904+
* Prior to 1.7 (pg7.3) we relied on the internally maintained
905+
* pointer. Now we rely on ftello() always, unless the file has been
906+
* found to not support it. For debugging purposes, print a warning
907+
* if the internal pointer disagrees, so that we're more likely to
908+
* notice if something's broken about the internal position tracking.
909+
*/
902910
pos=ftello(AH->FH);
911+
if (pos<0)
912+
exit_horribly(modulename,"could not determine seek position in archive file: %s\n",
913+
strerror(errno));
914+
903915
if (pos!=ctx->filePos)
904-
{
905916
write_msg(modulename,"WARNING: ftell mismatch with expected position -- ftell used\n");
906-
907-
/*
908-
* Prior to 1.7 (pg7.3) we relied on the internally maintained
909-
* pointer. Now we rely on ftello() always, unless the file has
910-
* been found to not support it.
911-
*/
912-
}
913917
}
914918
else
915919
pos=ctx->filePos;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp