Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5e8e794

Browse files
committed
Focus on ftello result < 0 instead of errno
Rather than reset errno (or just hope that its cleared already), check just the result of the ftello for < 0 to determine if there was an issue. Oversight by me, pointed out by Tom.
1 parent 8198a32 commit 5e8e794

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/bin/pg_dump/pg_backup_custom.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ _CloseArchive(ArchiveHandle *AH)
708708
{
709709
WriteHead(AH);
710710
tpos = ftello(AH->FH);
711-
if (tpos < 0 || errno)
711+
if (tpos < 0)
712712
exit_horribly(modulename, "could not determine seek position in archive file: %s\n",
713713
strerror(errno));
714714
WriteToc(AH);
@@ -757,9 +757,8 @@ _ReopenArchive(ArchiveHandle *AH)
757757
if (!ctx->hasSeek)
758758
exit_horribly(modulename, "parallel restore from non-seekable file is not supported\n");
759759

760-
errno = 0;
761760
tpos = ftello(AH->FH);
762-
if (tpos < 0 || errno)
761+
if (tpos < 0)
763762
exit_horribly(modulename, "could not determine seek position in archive file: %s\n",
764763
strerror(errno));
765764

0 commit comments

Comments
 (0)