]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix bug in TOC file error message printing
authorDaniel Gustafsson <dgustafsson@postgresql.org>
Tue, 19 Oct 2021 10:59:54 +0000 (12:59 +0200)
committerDaniel Gustafsson <dgustafsson@postgresql.org>
Tue, 19 Oct 2021 10:59:54 +0000 (12:59 +0200)
commit038892c8101845b6b4364cf2f5773207c4a4525c
tree50f7675224a42c8d7475a151cea2f72b40fa2853
parent931f3926a9f69e8de4a673b05b8e7a1fffc1d0d9
Fix bug in TOC file error message printing

If the blob TOC file cannot be parsed, the error message was failing
to print the filename as the variable holding it was shadowed by the
destination buffer for parsing.  When the filename fails to parse,
the error will print an empty string:

 ./pg_restore -d foo -F d dump
 pg_restore: error: invalid line in large object TOC file "": ..

..instead of the intended error message:

 ./pg_restore -d foo -F d dump
 pg_restore: error: invalid line in large object TOC file "dump/blobs.toc": ..

Fix by renaming both variables as the shared name was too generic to
store either and still convey what the variable held.

Backpatch all the way down to 9.6.

Reviewed-by: Tom Lane
Discussion: https://postgr.es/m/A2B151F5-B32B-4F2C-BA4A-6870856D9BDE@yesql.se
Backpatch-through: 9.6
src/bin/pg_dump/pg_backup_directory.c