aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2014-05-06 10:00:57 -0400
committerBruce Momjian <bruce@momjian.us>2014-05-06 10:01:20 -0400
commit55d5ff825fae0ee9a1114a17fcd97a3e360a23b0 (patch)
treeb5dfbf6f1611414736e4e8e5b850acdf3f2bc5d8
parent2e54d88af137da5c1cf4749e2b9d4371224bbd47 (diff)
downloadpostgresql-55d5ff825fae0ee9a1114a17fcd97a3e360a23b0.tar.gz
postgresql-55d5ff825fae0ee9a1114a17fcd97a3e360a23b0.zip
Fix detection of short tar files, broken by commit 14ea89366fe321609afc5838ff9fe2ded1cd707d
Report by Noah Misch
-rw-r--r--src/bin/pg_dump/pg_backup_archiver.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c
index adf91e1697c..2fa21193f51 100644
--- a/src/bin/pg_dump/pg_backup_archiver.c
+++ b/src/bin/pg_dump/pg_backup_archiver.c
@@ -2034,10 +2034,13 @@ _discoverArchiveFormat(ArchiveHandle *AH)
exit_horribly(modulename, "input file appears to be a text format dump. Please use psql.\n");
}
- if (AH->lookaheadLen != 512 && feof(fh))
- exit_horribly(modulename, "input file does not appear to be a valid archive (too short?)\n");
- else
- READ_ERROR_EXIT(fh);
+ if (AH->lookaheadLen != 512)
+ {
+ if (feof(fh))
+ exit_horribly(modulename, "input file does not appear to be a valid archive (too short?)\n");
+ else
+ READ_ERROR_EXIT(fh);
+ }
if (!isValidTarHeader(AH->lookahead))
exit_horribly(modulename, "input file does not appear to be a valid archive\n");